after the vue parent component updates the data through the ref call child component method, the view part updates
and calling the unified method in the subcomponent mounted () {} can update
vue version 2.5.15
parent.vue
this.$nextTick(() => {
this.$refs.carInfo.getDetail(data)
})
child.vue
data () {
return {
imgUrl: "",
plate_number: "",
car_detail: {
serial_number: "",
plate_type: "",
china_brand: "",
model: "",
car_type: "",
color: "",
use_for: "",
inspection_date: ""
},
car_owner: {
name: "",
identification_number: "",
quasi_drive_type: "",
expire_date: "",
cumulative_score: "",
license_status: ""
},
}
},
methods: {
getetail(){
this.obj = res.content // $refs.name.getDetail()
}
},
beforeUpdate () {
console.log("before update", this.$data)
},
updated () {
console.log("update", this.$data)
},
mounted(){
// setTimeout(() => {
// this.getDetail()
// }, 3000)
}
Vue.$set (.), doesn"t work either