vue-design-core
Advanced tools
Comparing version 0.1.1 to 0.1.2
11
index.js
@@ -5,7 +5,8 @@ import VueDesign, { | ||
http, | ||
to, | ||
filtersCommit, | ||
App, | ||
UIComponents | ||
} from './lib/vueDesign'; | ||
import to from './lib/utils/to'; | ||
import { filtersCommit } from './lib/utils'; | ||
import { config, configs } from './lib/configs'; | ||
@@ -16,8 +17,10 @@ export { | ||
http, | ||
UIComponents, | ||
App, | ||
to, | ||
config, | ||
configs, | ||
filtersCommit, | ||
App, | ||
UIComponents | ||
} | ||
export default VueDesign; |
import Router from 'vue-router'; | ||
import { config } from './configs'; | ||
@@ -6,7 +7,8 @@ export default function vueDesignRouter(Vue, options = {}) { | ||
Vue.use(Router); | ||
console.log('rootRoutes-b000', rootRoutes); | ||
const router = new Router({ | ||
mode: 'history', | ||
mode: config('globals.js').routerMode || 'history', | ||
routes: [ | ||
...rootRoutes | ||
...rootRoutes, | ||
...config('routes.js') | ||
] | ||
@@ -13,0 +15,0 @@ }); |
@@ -38,1 +38,11 @@ | ||
}; | ||
export function getConfig(configCache, fileName) { | ||
if (!configCache[fileName]) { | ||
return false; | ||
} | ||
if (configCache[fileName].default) { | ||
return configCache[fileName].default | ||
} | ||
return configCache[fileName]; | ||
} |
import { getConfig } from './index'; | ||
const configContext = require.context('@configs', true, /^\.\/([a-zA-Z0-9_-]*)\.(js|json)$/); | ||
const globalContext = require.context('@globals', true, /^\.\/([a-zA-Z0-9_-]*)\/(config\.json|routes\.js|store\.js)$/); | ||
@@ -6,2 +9,16 @@ const moduleContext = require.context('@modules', true, /^\.\/([a-zA-Z0-9_-]*)\/(config\.json|routes\.js|store\.js)$/); | ||
const configCache = (() => { | ||
const cacheData = {}; | ||
configContext.keys().forEach(keyUrl => { | ||
const [, keyName] = keyUrl.split('/'); | ||
cacheData[keyName] = configContext(keyUrl); | ||
}); | ||
return cacheData; | ||
})(); | ||
const getGolbals = (defaultModuleRouter) => { | ||
const golbalsConfig = getConfig(configCache, 'golbals.js'); | ||
return golbalsConfig.moduelRouter || defaultModuleRouter; | ||
} | ||
const globalCache = getCache(globalContext); | ||
@@ -28,3 +45,3 @@ | ||
const currentRoutes = rootRoutes.find(item => item.name === 'admin'); | ||
const currentRoutes = rootRoutes.find(item => item.name === getGolbals('admin')); | ||
currentRoutes.children = childrenRoutes; | ||
@@ -56,2 +73,4 @@ | ||
console.log('configCache', configCache); | ||
export { | ||
@@ -61,3 +80,4 @@ rootRoutes, | ||
configs, | ||
vendorCache | ||
vendorCache, | ||
configCache | ||
}; |
@@ -11,14 +11,10 @@ | ||
import vueDesignUIComponents from './UIComponents'; | ||
import to from './utils/to'; | ||
import { filtersCommit } from './utils'; | ||
import { config } from './configs'; | ||
import vendor from './vendor'; | ||
import App from '@/App'; | ||
import * as interceptors from '@/configs/interceptors'; | ||
import { rootRoutes, modules } from './utils/requireContext'; | ||
vendor(Vue); | ||
const interceptors = config('interceptors.js'); | ||
const router = vueDesignRouter(Vue, { | ||
@@ -56,4 +52,2 @@ rootRoutes, | ||
http, | ||
to, | ||
filtersCommit, | ||
App, | ||
@@ -60,0 +54,0 @@ UIComponents |
{ | ||
"name": "vue-design-core", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11354
14
385