聚合更新组件外部的对象,并反映对UI的更改

时间:2016-05-09 11:58:09

标签: polymer polymer-1.0

是否可以反映聚合物组件属性的更改,而无需通过.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
         }               
        })

0 个答案:

没有答案