一、一级路由
import Vue from 'vue';
import Router from 'vue-router';
import Home from '@/pages/Home.vue';
import City from '@/pages/City.vue';
Vue.use(Router)
export default new Router({
mode:'history',
routes:[
{
path: '/',
name: 'home',
component: Home
},
{
path: '/city',
name: 'city',
component: City
}
]
})
二、路由导航
//App.vue
<div>
<router-link to="/home">home</router-link>
<router-link to="/city">city</router-link>
</div>
//被选中的路由模块颜色
.router-link-active{
color:red;
}