有一个父元素。 它的一个属性是一组对象。 这个数组在ready函数中被初始化。 该数组的显示传递给子元素。 我想要做的是每当multiplier属性更改时更新数组中每个元素的数量。 我试图使用文档中描述的覆盖脏检查技术,但无法使其工作。 我希望得到一些指导。 [plunker链接] [1]
[1]: http://plnkr.co/edit/pCZyUC7YtgUU8cpejNpj?p=infoThere is a parent element. One of its property is an array of objects. This array is initialised in the ready function. The display of this array is handed down to a child element. What I want to do is to update the quantity of each element in the array whenever the multiplier property changed. I tried to use the override dirty checking technique described in the docs but couldn't get it to work. I would appreciate some guidance. [plunker link][1]
[1]: http://plnkr.co/edit/pCZyUC7YtgUU8cpejNpj?p=info最满意答案
这是一个工作的例子: Plunk
很少有事情得到纠正,其中一个是:
//DO not use 'this.setItems.0.quantity.value', but: this.set('setItems.0.quantity.value', newQuantity); console.log("New arr val: "); console.log(this.setItems[0].quantity.value);文档:
https://www.polymer-project.org/1.0/docs/devguide/model-data
https://www.polymer-project.org/1.0/docs/devguide/data-binding#array-binding
Here is working example: Plunk
Few things are corrected, one is this:
//DO not use 'this.setItems.0.quantity.value', but: this.set('setItems.0.quantity.value', newQuantity); console.log("New arr val: "); console.log(this.setItems[0].quantity.value);Docs:
https://www.polymer-project.org/1.0/docs/devguide/model-data
https://www.polymer-project.org/1.0/docs/devguide/data-binding#array-binding
更多推荐
发布评论