1.简单粗暴的方式
this.$forceUpdate();//强制更新
2.增减元素
splice() push()
3.通过$set进行更新
this.$set(v, 'edit', false)
4.异步dom更新
Vue.nextTick() .then(function () { // DOM 更新了 })
以上就是常见的强制更新方法,亲测好用。
1.简单粗暴的方式
this.$forceUpdate();//强制更新
2.增减元素
splice() push()
3.通过$set进行更新
this.$set(v, 'edit', false)
4.异步dom更新
Vue.nextTick() .then(function () { // DOM 更新了 })
以上就是常见的强制更新方法,亲测好用。