/* jshint esversion: 6 */注webstrom中不添加改注释报es6错误提示
import Vue from 'vue';
import Router from 'vue-router';
import HelloWorld from '../components/HelloWorld';
import first from '../components/first';
import second from '../components/second';
import third from '../components/third';
Vue.use(Router);export default new Router({
routes: [
{
path:"/HelloWorld",
redirect:'/HelloWorld'
},
{
path: '/',
name: 'HelloWorld',//路由名称<router-link :to='{name:'helloWorld'}'>或者<router-link to:'./'也就是path>
component: HelloWorld
},
{
path:"/first",
name:'a',
component:first
},
{
path:"/second",
name:"second",
component:second,
children:[
{
path:"/second/third",//目录为http://localhost:8087/#/second/third;path:"/third"目录为http://localhost:8087/#/third
name:"aa",
component:third
}
]
}
]
});
且主要的router-link应该放入app.vue文件,
单个组件内部的子路由在该对应的组件内添加router-link