父组件
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})