共计 345 个字符,预计需要花费 1 分钟才能阅读完成。
父组件
setup () {
const data = reactive({deviceTypesTotal: {}
})
provide('deviceTypesTotal', data.deviceTypesTotal)
子组件
import {defineComponent, reactive, toRefs, ref, onMounted, inject , watch} from 'vue'
const deviceTypesTotal = inject('deviceTypesTotal')
watch(deviceTypesTotal, (newValue) => {console.log(newValue)
data.deviceTypesTotal = newValue.deviceTypesTotal
},{deep:true})
正文完