Vue.js - update router view

后端 未结 2 479
再見小時候
再見小時候 2020-12-12 00:25

I am new to Vue.js and encountered this problem.

I have this simple piece of code in App.vue

2条回答
  •  感动是毒
    2020-12-12 01:17

    This happens when you enter a route you are already on, and the component is not reloaded, even though the parameters are different. Change your router-view to:

    
    

    Vue tries to reuse components when possible, which is not what you want in this situation. The key attribute tells Vue to use a different instance of a component for each unique key rather than reusing one. Since the path is different for each set of parameters, that will make a good key.

提交回复
热议问题