refactor router
This commit is contained in:
		
							
								
								
									
										6
									
								
								.babelrc
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								.babelrc
									
									
									
									
									
								
							@@ -8,12 +8,10 @@
 | 
			
		||||
    }],
 | 
			
		||||
    "stage-2"
 | 
			
		||||
  ],
 | 
			
		||||
  "plugins":["transform-vue-jsx", "transform-runtime"],
 | 
			
		||||
  "env": {
 | 
			
		||||
    "development":{
 | 
			
		||||
      "plugins": ["transform-vue-jsx", "transform-runtime", "dynamic-import-node"]
 | 
			
		||||
    },
 | 
			
		||||
    "production": {
 | 
			
		||||
      "plugins": ["transform-vue-jsx", "transform-runtime"]
 | 
			
		||||
      "plugins": ["dynamic-import-node"]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -7,8 +7,8 @@
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "dev": "cross-env BABEL_ENV=development webpack-dev-server --inline --progress --config build/webpack.dev.conf.js",
 | 
			
		||||
    "start": "npm run dev",
 | 
			
		||||
    "build": "cross-env BABEL_ENV=production node build/build.js",
 | 
			
		||||
    "build:report": "cross-env BABEL_ENV=production npm_config_report=true node build/build.js",
 | 
			
		||||
    "build": "node build/build.js",
 | 
			
		||||
    "build:report": "npm_config_report=true node build/build.js",
 | 
			
		||||
    "lint": "eslint --ext .js,.vue src",
 | 
			
		||||
    "test": "npm run lint"
 | 
			
		||||
  },
 | 
			
		||||
@@ -36,7 +36,7 @@
 | 
			
		||||
    "babel-preset-stage-2": "6.24.1",
 | 
			
		||||
    "chalk": "2.3.0",
 | 
			
		||||
    "copy-webpack-plugin": "4.2.3",
 | 
			
		||||
    "cross-env": "^5.1.1",
 | 
			
		||||
    "cross-env": "5.1.1",
 | 
			
		||||
    "css-loader": "0.28.7",
 | 
			
		||||
    "eslint": "4.13.1",
 | 
			
		||||
    "eslint-friendly-formatter": "3.0.0",
 | 
			
		||||
 
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
module.exports = file => require('@/views/' + file + '.vue').default // vue-loader at least v13.0.0+
 | 
			
		||||
@@ -1 +0,0 @@
 | 
			
		||||
module.exports = file => () => import('@/views/' + file + '.vue')
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
import Vue from 'vue'
 | 
			
		||||
import Router from 'vue-router'
 | 
			
		||||
const _import = require('./_import_' + process.env.NODE_ENV)
 | 
			
		||||
 | 
			
		||||
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
 | 
			
		||||
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading
 | 
			
		||||
 | 
			
		||||
@@ -19,8 +19,8 @@ import Layout from '../views/layout/Layout'
 | 
			
		||||
  }
 | 
			
		||||
**/
 | 
			
		||||
export const constantRouterMap = [
 | 
			
		||||
  { path: '/login', component: _import('login/index'), hidden: true },
 | 
			
		||||
  { path: '/404', component: _import('404'), hidden: true },
 | 
			
		||||
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
 | 
			
		||||
  { path: '/404', component: () => import('@/views/404'), hidden: true },
 | 
			
		||||
 | 
			
		||||
  {
 | 
			
		||||
    path: '/',
 | 
			
		||||
@@ -30,7 +30,7 @@ export const constantRouterMap = [
 | 
			
		||||
    hidden: true,
 | 
			
		||||
    children: [{
 | 
			
		||||
      path: 'dashboard',
 | 
			
		||||
      component: _import('dashboard/index')
 | 
			
		||||
      component: () => import('@/views/dashboard/index')
 | 
			
		||||
    }]
 | 
			
		||||
  },
 | 
			
		||||
 | 
			
		||||
@@ -44,13 +44,13 @@ export const constantRouterMap = [
 | 
			
		||||
      {
 | 
			
		||||
        path: 'table',
 | 
			
		||||
        name: 'Table',
 | 
			
		||||
        component: _import('table/index'),
 | 
			
		||||
        component: () => import('@/views/table/index'),
 | 
			
		||||
        meta: { title: 'Table', icon: 'table' }
 | 
			
		||||
      },
 | 
			
		||||
      {
 | 
			
		||||
        path: 'tree',
 | 
			
		||||
        name: 'Tree',
 | 
			
		||||
        component: _import('tree/index'),
 | 
			
		||||
        component: () => import('@/views/tree/index'),
 | 
			
		||||
        meta: { title: 'Tree', icon: 'tree' }
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
@@ -63,7 +63,7 @@ export const constantRouterMap = [
 | 
			
		||||
      {
 | 
			
		||||
        path: 'index',
 | 
			
		||||
        name: 'Form',
 | 
			
		||||
        component: _import('form/index'),
 | 
			
		||||
        component: () => import('@/views/form/index'),
 | 
			
		||||
        meta: { title: 'Form', icon: 'form' }
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user