mounted() {
new MutationObserver(this.handleReturn).observe(
this.$slots.default[this.$slots.default.length - 1].componentInstance.$children[0].$el,
{
attributes: true,
}
);
},
methods: {
handleClick(event) {
event.stopPropagation();
},
handleReturn() {
for (let i = 0; i < this.$slots.default.length; i++) {
if (this.$slots.default[i].componentInstance) {
if (this.$slots.default[i].componentInstance[this.bindValue] && Object.keys(this.$slots.default[i].componentInstance[this.bindValue]).length !== 0) {
if (
!this.shallowEqual(this.$slots.default[i].componentInstance[this.bindValue],
this.dataInternal)
) {
this.dataInternal =
this.$slots.default[i].componentInstance[this.bindValue];
console.log("this.keyEid",this.keyEid);
console.log("this.keys",this.keys);
if (this.keyEid !== undefined && this.keys !== undefined) {
this.$emit("update:keyEid", this.dataInternal[this.keys]);
}
this.$emit("input", this.dataInternal);
}
}
}
}
},
}
发现如果componentInstance中修改了对象本身 , 而不是修改原对象 的属性 , 获取的对象是原来的对象 , 而不是现在的对象 , 就无法响应 , 应该如何处理呢