Keeping Vue.js routes on the same page
P粉904405941
2023-08-25 12:27:01
<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>
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.