In my Vuejs project, I have two pages located at the same level with a common component. However, when I redirect from post/new to post/edit/:id, the beforeMount method is not being called.
redirect() {
this.$router.push({path: `home/post/edit/${this.post.id}`})
},
Routes:
{
path: 'home',
name: 'home',
component: {
render(c) {
return c('router-view')
}
},
children: [
{
path: 'post/new',
component: PostForm,
name: 'Create',
props: {readOnly: false}
},
{
path: 'post/edit/:id',
component: PostForm,
name: 'Edit',
props: {readOnly: false}
},
]
},