12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- const Router = VueRouter;
- const routes = [
- //默认跳转到登录页
- {
- path: "/",
- redirect: "/loadingPage"
- },
- //loading
- {
- path: '/loadingPage',
- component: () => import('@/views/loadingPage/index'),
- hidden: true
- },
- //商品选择
- {
- path: '/good-share',
- component: () => import('@/views/good-share/index'),
- hidden: true
- },
- //方案选择
- {
- path: '/plan-change',
- component: () => import('@/views/plan-change/index'),
- hidden: true
- },
-
- //登录页
- {
- path: '/login',
- component: () => import('@/views/login/index'),
- hidden: true
- },
- //忘记密码
- {
- path: '/forget-password',
- component: () => import('@/views/login/forget-password'),
- hidden: true,
- noCache: true
- },
- ];
- console.log(process.env.BASE_URL);
- const router = new Router({
- mode: "hash",
- base: process.env.BASE_URL,
- scrollBehavior: () => ({ y: 0 }),
- routes
- });
- // 重写路由的push方法,主要是为了解决同一个路由路径重复点击报错
- const routerPush = Router.prototype.push;
- Router.prototype.push = function push(location) {
- return routerPush.call(this, location).catch(error => error);
- };
- Vue.use(Router);
- export default router;
|