是否可以反映聚合物组件属性的更改,而无需通过.set(path, value)
更新值。
例如,我有覆盖setter的对象,基于此值将新值应用于其他字段。
Polymer({
is: 'x-element',
properties: {
form: {type: Object,
value: {
set name(v) {
this._name = v;
this.additional = v; // change the different property
},
get name() {
return this.name;
},
set additional(v) {
// process v
this._additional = v; // field does not reflect
},
get additional() {
return this._additional;
}
},
reflectToAttribute: true
}
})