这篇文章主要为大家详细介绍了vue二级路由设置方法,具有一定的参考价值,可以用来参考一下。
感兴趣的小伙伴,下面一起跟随四海网的小编两巴掌来看看吧!
项目当中使用vue的时候一定会用到路由,并且二级路由甚至三集路由的需求都是刚需,当然,多级路由的配置方法和二级的是一样的,简单讲讲二级路由的配置吧。
代码如下:
<router-link to="/discover">
<div @click="clickFind('发现')">
<span class="icon-find"></span>
<p>发现</p>
</div>
</router-link>
<router-link to="/todayStudy">
<div @click="clickStudy('今日学习')">
<span class="icon-todayStudy"></span>
<p>今日学习</p>
</div>
</router-link>
<router-link to="/listenAnyWhere">
<div @click="clickListen('随时听')">
<span class="icon-listenAny"></span>
<p>随时听</p>
</div>
</router-link>
<router-link to="/bought">
<div @click="clickBought('已购')">
<span class="icon-areadyBy"></span>
<p>已购</p>
</div>
</router-link>
<router-link to="/mine">
<div @click="clickMe">
<span class="icon-me"></span>
<p>我</p>
</div>
</router-link>
</div>
<router-view></router-view>
代码如下:
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
}
];
【q1010.com温馨提示:图片暂缺】
【q1010.com温馨提示:图片暂缺】
【q1010.com温馨提示:图片暂缺】
代码如下:
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,
<span style="color:#ff0000;">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
}
]</span>
},
【q1010.com温馨提示:图片暂缺】
以上这篇vue二级路由设置方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持四海网。
本文来自:http://www.q1010.com/184/4686-0.html
注:关于vue二级路由设置方法的内容就先介绍到这里,更多相关文章的可以留意四海网的其他信息。
关键词:vue.js
四海网收集整理一些常用的php代码,JS代码,数据库mysql等技术文章。