您好,欢迎访问一九零五行业门户网

vue.js路由显示设置的方法介绍

本篇文章给大家带来的内容是关于vue.js路由显示设置的方法介绍,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
①设置 path 为 ‘/’const router= new vuerouter({ routes:[ {path:'/',name:'home',component:home}, //页面第一显示的组件 {path:'/menu',name:'menu',component:menu}, {path:'*',redirect:'/'} ], mode:"history"});
②设置 redirect 的值(适用于 二级路由)
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"});
相关推荐:
vue.js中二级路由和三级路由的代码解析
vue.js路由器的使用方法总结(附代码)
以上就是vue.js路由显示设置的方法介绍的详细内容。
其它类似信息

推荐信息