wuchangming/blog

路由如果是异步加载的怎么写呢

Closed this issue · 1 comments

路由如果是异步加载的怎么写呢

const components = require.context('@/components', true, /[A-Z]\w+.(vue)$/, 'lazy');
components.keys().forEach(filePath => {

// load the component
components(filePath).then(module => {

// module.default is the vue component
console.log(module.default);

});
});