1. Route start Route parameter: article {path:'/article/:id'} Parameter id. $route.push({path:'/article',query:{id:id}}) {beforeCreate(){if(this.$route.query.id! = = null)}. Set the embedded routines by, redirect: {path: 'article' children: [{path: '/', redirect: '/ index'}]}Copy the code

The advanced

1. Check whether you have logged in to the system. If you have not logged in to the system, the login page is displayed. router.beforeEach((to,from,next)=>{ if (! to.auth.loggedIn()) { next({ path: '/login', query: { redirect: To.fullpath}})} else {next()}}) to: destination from: route leaving next: next hook Next (false) Interrupt navigation next('/') jump to another path next(error) 2. Routing meta information. Meta field {meta:{requireAuth:true}} 3. Obtaining data: 1. After navigation is complete, 2: 1. Watch :{'$route':'fetchData'} 2. BeforeRouteEnter Call the Next() method beforeRouteEnter(to,from, Next){getPost(to.params.id){}; Next ()} 4. Load const article=()=>import('/views/article.vue')Copy the code