本篇文章给大家带来的内容是关于vue.js路由显示设置的方法介绍,有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。
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"
});相关推荐:
系统特点:功能简洁实用。目前互联网上最简洁的企业网站建设系统!原创程序代码。非网络一般下载后修改的代码。更安全。速度快!界面模版分离。原创的分离思路,完全不同于其他方式,不一样的简单感受!搜索引擎优化。做了基础的seo优化。对搜索引擎更友好系统功能关于我们:介绍企业介绍类信息,可自由添加多个介绍栏目!资讯中心:公司或行业资讯类内容展示。可自由添加多个资讯内容!产品展示:支持类别设置,可添加产品图片
0
立即学习“前端免费学习笔记(深入)”;
以上就是vue.js路由显示设置的方法介绍的详细内容,更多请关注php中文网其它相关文章!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号