Keeping Vue.js routes on the same page
P粉904405941
P粉904405941 2023-08-25 12:27:01
0
1
411
<p>This is the first time I've encountered this, when I click the next button in the address bar, the address changes but the page remains the same as if I didn't click the next button. However, new steps are shown below. Hope someone can provide a solution. Thanks in advance. </p> <pre class="brush:php;toolbar:false;"><template> <div> <button @click="send" >Next</button> </div> </template> <script> methods:{ send(){ this.$router.push('/page/commande/1') } </script> //router { path:'/page/commande/1', name:'ConfirmationSend', component:() => import('../views/send.vue'), },</pre>
P粉904405941
P粉904405941

reply all(1)
P粉762447363

Hey, you should add the full path of the route (fullPath) as the key of the route view (router-view). This way the page/component will only be re-rendered when the url parameters change.

<router-view :key='$route.fullPath' />
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template