https://developer.salesforce.com/docs/component-library/tools/playground/GcVjmML4/2/edit 为什么不在视图上更新@track 值?以及如何强制更新值?
Parent.cmp
import { LightningElement } from 'lwc';
var OBG ={ data:
{name: "Valera",
lastName : "Pypkin",
lastNameTWO : "lastNameTWO1111",
tt: {
gg:{name:"aaaaa"}
}}
}
export default class App extends LightningElement {
OBG = OBG;
}
儿童.cmp
import { LightningElement, api, track } from 'lwc';
export default class Child extends LightningElement {
@api data;
@track _objCopy;
get item() {
return this.data.data;
}
handleClick(){
const Other = { name: "Valera",
lastName : "Pypkin",
lastNameTWO : "lastNameTWO1111",
tt: {
gg:{name:"gggg"}
}}
this.myobj = Other; //change track value;
}
get myobj() {
return this.item;
}
set myobj(value) {
this._objCopy = value;
}
}
为什么不更新视图中的@track 值?以及如何强制更新值?