Load page components synchronously
This commit is contained in:
parent
72375affee
commit
234380120e
|
@ -24,14 +24,14 @@ Vue.use(PiniaVuePlugin);
|
|||
Vue.component('SvgSprite', () => import('./components/SvgSprite.js'));
|
||||
Vue.component('ILink', ILink);
|
||||
|
||||
// ---------------------------------- mixins -----------------------------------
|
||||
Vue.mixin(hasModule);
|
||||
Vue.mixin(hasFlash);
|
||||
|
||||
// -------------------------------- Components ---------------------------------
|
||||
requireModules(require.context('./components/form', false, /\.vue$/, 'lazy'), Vue, 'f');
|
||||
requireModules(require.context('./components/ui', false, /\.vue$/, 'lazy'), Vue, 'ui');
|
||||
requireModules(require.context('./components/page', false, /\.vue$/, 'lazy'), Vue, 'page');
|
||||
requireModules(require.context('./components/page', false, /\.vue$/), Vue, 'page');
|
||||
|
||||
// ---------------------------------- mixins -----------------------------------
|
||||
Vue.mixin(hasModule);
|
||||
Vue.mixin(hasFlash);
|
||||
|
||||
// ----------------------------------- init ------------------------------------
|
||||
const el = document.getElementById('app');
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import {paramCase} from 'change-case';
|
||||
|
||||
export default function (context, Vue, prefix) {
|
||||
var isAsync = context.name === 'webpackAsyncContext';
|
||||
|
||||
context.keys().forEach((file) => {
|
||||
let componentName = paramCase(`${prefix}${file.replace(/^\.\/(.*?)\.vue$/g, '$1')}`);
|
||||
|
||||
console.log(componentName);
|
||||
Vue.component(componentName, () => context(file));
|
||||
Vue.component(componentName, isAsync ? () => context(file) : context(file).default);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue