Pushing to data-bound array used in dom-repeat (Polymer)

后端 未结 1 527
时光取名叫无心
时光取名叫无心 2021-01-23 13:12

I have a data-bound array (dom-repeat) in a custom Polymer element, and I need to push new data into the array. It\'s not displaying the items, even though it know

1条回答
  •  无人及你
    2021-01-23 13:48

    Use Polymer's array mutation methods when pushing items into the array:

    this.push('people', {"first": "Jane", "last": "Doe"});
    this.push('people', {"first": "Bob", "last": "Smith"});
    

    
      
      
      
    
    
    
      
    
      
        
    
        
      
    

    codepen

    0 讨论(0)
提交回复
热议问题