This article brings you an introduction to the method of vue.js routing display settings. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
const router= new VueRouter({ routes:[ {path:'/',name:'home',component:Home}, //页面第一显示的组件 {path:'/menu',name:'menu',component:Menu}, {path:'*',redirect:'/'} ], mode:"history" });
②Set redirect value (applicable to secondary routing)
const router= new VueRouter({ routes:[ {path:'/',name:'home',component:Home}, {path:'/about',name:'about',component:About,redirect:{name:'contactLink'},children:[ //二级路由 {path:'/about/contact',name:'contactLink',component:Contact}, {path:'/history',name:'historyLink',component:History}, ]}, {path:'*',redirect:'/'} ], mode:"history" });
Related recommendations:
Code analysis of secondary routing and third-level routing in vue.js
Summary of how to use Vue.js router (with code)
The above is the detailed content of Introduction to the method of vue.js route display setting. For more information, please follow other related articles on the PHP Chinese website!