Answer the question
In order to leave comments, you need to log in
Why is the root subrouter not loading?
Good evening, I have a problem...
I'll start in order, I created a dynamic router:
{
path:'/user/:login',
name:'UserPage',
component:UserPage,
}
{
path:'/user/:login',
name:'UserPage',
component:UserPage,
children:[
{
path:'',
name:'UserProfilePosts',
component:UserProfilePostsCom
}
]
}
<template>
<div class="UserProfilePostsCont">
<div class="UserProfilePosts">
<div class="UserProfilePost" v-for="PostData in postsData" :key="PostData.id">
<hr>
<p>{{PostData.Content}}</p>
<hr>
</div>
</div>
</div>
</template>
<script>
export default{
data: function(){
return{
postsData: null
}
},
created(){
const Login = this.$route.params.login
this.$axios.post(this.$server+'getposts', {'Login': Login})
.then(resp=>{
this.postsData = resp.data.Posts
})
}
}
</script>
<template>
<div>
<li>
<router-link to="/">Home</router-link>
</li>
<div>
<router-view/>
</div>
</div>
</template>
<script>
export default {
...
}
</script>
Answer the question
In order to leave comments, you need to log in
Components are cached and not re-created after the first transition, use hooks at the router, there are 3 hooks, hang on them in the component you need and load the info)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question