0👍
Disclaimer: I’ve though that you’re using .slice()
. So as long as you’re use splice this answer isn’t valid. But I’ll keep it here for the record. Also the answer contain link to documentation.
Yes, .splice()
updates array.
No, vuejs
don’t track such array mutations:
According to documentation:
Vue.js wraps an observed Array’s mutation methods so they will also
trigger View updates. The wrapped methods are:
- push()
- pop()
- shift()
- unshift()
- splice()
- sort()
- reverse()
And
filter()
,concat()
andslice()
, which do not mutate the original Array but always return a new Array
So the idea is to replace you array with a new one:
example1.items = example1.items.filter(function (item) {
return item.message.match(/Foo/)
})
- [Vuejs]-Vue binding value to input
- [Vuejs]-What is the best practice to develop the cross-platform components with Vue.js 2.0?
Source:stackexchange.com