Blame view

src/router/router.js 799 Bytes
22fb20b3   songchongxian   城市停车运营监控
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  import Vue from 'vue'
  import Router from 'vue-router'
  // import Login from '@/components/login'
  // import Index from '@/components/index'
  import index from '../components/index/layout'
  Vue.use(Router)
  const routes = [
    {
      //path: '',component: index,
      path: '*',
      name: 'index',
      component: index
    }
  ];
  const router=new Router({ routes ,mode: 'history'});//hash(带#)值模式,vue-router 默认 hash 模式
  //router.beforeEach((to, from, next) => {
  //  if (to.matched.length ===0) {//如果未匹配到路由
  //    from.name ? next({ name:from.name }) : next('/');//如果上级也未匹配到路由则跳转登录页面,如果上级能匹配到则转上级路由
  //  } else {
  //    next();//如果匹配到正确跳转
  //  }
  //});
  //router.push(index);
  export default router;