1. 保证父组件的值是代理对象,非普通对象
const state = reactive({
currentWall: null, //选中的设备数据
})
2. 保证子组件能够监听到
watch中建议写法:() => props.detail
,不要图省事用props.detail
const props = defineProps({
detail: Object
})
watch(
() => props.detail, // 建议这种写法
(newValue) => {
detailInfo.value = JSON.parse(JSON.stringify(newValue))
console.log(props.detail, 'props.detail接收之后=========')
}, {
deep: true,
});