diff --git a/src/components/VideoDialog/index.vue b/src/components/VideoDialog/index.vue index 3f397a0..d3e5f35 100644 --- a/src/components/VideoDialog/index.vue +++ b/src/components/VideoDialog/index.vue @@ -49,8 +49,8 @@
-
收藏
-
取消收藏
+
收藏
+
取消收藏
@@ -98,38 +98,36 @@ let videoRef = ref() let webRtcServer = null let hlsRef = null - + let colletCond = ref(props.isCollect) + let isDayCurr = ref(props.isDiy) watch( - () => props.isCollect, + () =>modelValue.value, (val) => { - if (val) { - // colletCond.value = val - // setTimeout(() => { - // init() - // }, 1000) - }else{ - // colletCond.value = 0 - } + // colletCond.value = props.isCollect + // isDayCurr.value = props.isDiy + console.log(props.isDiy,'val[0].value') + }, { immediate: true } ) - let colletCond = ref(props.isCollect) - let isDayCurr = ref(props.isDiy) + const emit = defineEmits(['isDiyChange']); // 收藏 const handleCollectAdd = async (id, status, index) => { await getColletDiyApi({ - cameraIndexCode:id, - isDiy: isDayCurr.value == 0 ? 1 : 0 + cameraIndexCode:props.cameraIndexCode, + isDiy: props.isDiy == 0 ? 1 : 0 }) - if(isDayCurr.value==1){ + + if(props.isDiy==1){ isDayCurr.value=0 // modelValue.value = false }else{ isDayCurr.value=1 } - pubSub.publish('videoIsDiy',{isDiy:isDayCurr.value,cameraIndexCode:props.cameraIndexCode} ) + emit('isDiyChange', isDayCurr.value); + pubSub.publish('videoIsDiy',{isDiy:props.isDiy,cameraIndexCode:props.cameraIndexCode} ) } // 关注 @@ -138,6 +136,7 @@ cameraIndexCode:props.cameraIndexCode, isCollect: colletCond.value == 0 ? 1 : 0 }) + if (colletCond.value == 0) { colletCond.value = 1 } else { diff --git a/src/views/collect/components/video-box.vue b/src/views/collect/components/video-box.vue index c2481d7..da8298e 100644 --- a/src/views/collect/components/video-box.vue +++ b/src/views/collect/components/video-box.vue @@ -14,7 +14,7 @@ width:(100/grad)+'%' }"> -
+
-->
- +