0👍
Vue will handle the DOM updates automatically, so you simply need to change the order of the elements in the array in your operate
method and the DOM will update:
operate: function () {
this.list = ['two', 'one', 'three'];
}
If you actually want to rearrange the list instead of completely redefining it, you’ll need to call $set()
or splice()
on the array (see the common beginner gotchas):
operate: function() {
var temp = this.list[0];
this.list.$set(0, this.list[1]);
this.list.$set(1, temp);
}
- [Vuejs]-Vue.js call method on service in component
- [Vuejs]-Firebase + Vue + Vuex: Keeping The User Logged In
Source:stackexchange.com