多平台统一管理软件接口,如何实现多平台统一管理软件接口
359
2023-02-18
vue二级路由设置方法
项目当中使用vue的时候一定会用到路由,并且二级路由甚至三集路由的需求都是刚需,当然,多级路由的配置方法和二级的是一样的,简单讲讲二级路由的配置吧。
首先把一级路由的结构准备好:
发现
今日学习
随时听
已购
我
TIgAjx
在main.js里引入模块,并配置路由:
import discover from './components/discover/discover.vue';
import todayStudy from './components/todayStudy/study.vue';
import listen from './components/listenAnyWhere/listen.vue';
import bought from './components/bought/bought.vue';
import mine from './components/mine/mine.vue';
const routes = [
{
path: '/',
redirect: '/discover'
},
{
path: '/discover',
component: discover
},
{
path: '/todayStudy',
component: todayStudy
},
{
path: '/listenAnyWhere',
component: listen
},
{
path: '/bought',
component: bought
},
{
path: '/mine',
component: mine
}
];
先看效果
点击每天听本书后进入下一级
在main.js里设置二级路由
import thisMouth from './components/discover/detailEveryDay/thisMouth/thisMouth.vue';
import four from './components/discover/detailEveryDay/fourth/fourth.vue';
import three from './components/discover/detailEveryDay/three/third.vue';
import two from './components/discover/detailEveryDay/two/second.vue';
import one from './components/discover/detailEveryDay/one/first.vue';
import twel from './components/discover/detailEveryDay/twe/twel.vue';
import elev from './components/discover/detailEveryDay/elven/elev.vue';
const routes = [
{
path: '/',
redirect: '/discover'
},
{
path: '/discover',
component: discover,
children: [
{
path: '/',
component: thisMouth
},
{
path: '/thisMouth',
component: thisMouth
},
{
path: '/forthMouth',
component: four
},
{
path: '/thirdMouth',
component: three
},
{
path: '/secondMouth',
component: two
},
{
path: '/firstMouth',
component: one
},
{
path: '/elMouth',
component: twel
},
{
path: '/twMouth',
component: elev
}
]
},
在相应的路径下建立各个路由所需模块即可
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~