This repository was archived by the owner on May 12, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212export default {
1313 data () {
1414 return {
15- layout: ' Login '
15+ layout: ' material ' // Default layout file name
1616 }
1717 },
1818
Original file line number Diff line number Diff line change 44
55 <el-container >
66 <el-header >header</el-header >
7- <el-main >main</ el-main >
7+ <router-view / >
88 <el-footer >footer</el-footer >
99 </el-container >
1010 </el-container >
Original file line number Diff line number Diff line change 1+ // ! constant component path, based on `/src` directory
2+ export default [
3+ 'layout/Login' ,
4+ 'layout/Material' ,
5+ 'pages/Home'
6+ ]
Original file line number Diff line number Diff line change 1+ export default function createImporters ( components ) {
2+ const importers = { }
3+ components . forEach ( path => {
4+ const chunkName = createChunkName ( path )
5+ if ( ! importers [ chunkName ] ) {
6+ importers [ chunkName ] = ( ) => import (
7+ /* webpackChunkName: 'async/[request][index]' */
8+ `SOURCE/${ path } `
9+ )
10+ }
11+ } )
12+ return importers
13+ }
14+
15+ function createChunkName ( path ) {
16+ const normalizePathSection = path . split ( '/' ) . map ( ( pathSection , index ) => {
17+ return index === 0
18+ ? pathSection . replace ( / ^ [ A - Z ] / , matchKey => matchKey . toLowerCase ( ) )
19+ : pathSection . replace ( / ^ [ a - z ] / , matchKey => matchKey . toUpperCase ( ) )
20+ } )
21+ return normalizePathSection . join ( '' )
22+ }
Original file line number Diff line number Diff line change 1+ import createImporters from './importer'
2+ import constant from './constant'
3+
4+ export const constantComponents = createImporters ( constant )
Original file line number Diff line number Diff line change 11import Vue from 'vue'
22import Router from 'vue-router'
3+ import { constantComponents } from './components'
34
45Vue . use ( Router )
56
@@ -8,7 +9,7 @@ export default new Router({
89 {
910 path : '/' ,
1011 name : 'home' ,
11- component : ( ) => import ( /* webpackChunkName: 'home' */ `PAGES/Home` )
12+ component : constantComponents . pagesHome
1213 }
1314 ]
1415} )
You can’t perform that action at this time.
0 commit comments