admin管理员组文章数量:1305127
I have array named List and created puted property putedList for him. When i update value of array it's not showing in html, but in console i see thar array is updated.
`/`
What is best way to use puted properties for array?
Maybe is exists way to trigger to re-render puted property?
I have array named List and created puted property putedList for him. When i update value of array it's not showing in html, but in console i see thar array is updated.
`https://jsfiddle/apokjqxx/69/`
What is best way to use puted properties for array?
Maybe is exists way to trigger to re-render puted property?
Share Improve this question edited Jan 13, 2017 at 17:48 maxxdev asked Jan 13, 2017 at 17:43 maxxdevmaxxdev 3132 gold badges5 silver badges14 bronze badges 3- Some code would help. Do you have a jsfiddle showing the problem? Computed properties should work just fine and show updated values if the properties they reference update as well – georaldc Commented Jan 13, 2017 at 17:58
- Code is here jsfiddle/apokjqxx/69. Computed propertis working fine for object and not for arrays by default. – maxxdev Commented Jan 13, 2017 at 18:01
- 1 It's a vuejs limitation where it cannot pickup changes if you directly modify the array that way. vuejs/2016/02/06/mon-gotchas – georaldc Commented Jan 13, 2017 at 18:17
1 Answer
Reset to default 9Due to limitations in JavaScript, Vue cannot detect the changes to an array like this: this.list[1] = 'vueman'
You have to use Vue.set
or vm.$set
as explained here to trigger state updates in the reactivity system, like follwoing:
this.$set(this.list, 1, 'vueman')
see updated fiddler here.
本文标签: javascriptVuejs2 How to rerender array computed properties when array changedStack Overflow
版权声明:本文标题:javascript - Vuejs2: How to re-render array computed properties when array changed - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741789177a2397560.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论