Vue remount to solve data refresh problem

View does not refresh after array and object change in vue

At this time, it can be solved by global set or instance set

but less elegant

 

Using the trick of remounting, you can refresh the view, although it is a bit inefficient, but the easiest

Mount manually with $mount() 
 

        vm.$mount("#app");  

 

In the instance, after changing the data, remount so that the view refreshes again

But the mounted hook will not be triggered

this.$mount()

 

 

 

Notice

This way the list animation will not be triggered!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325123389&siteId=291194637