1、动态导入和注册
const componentsContext = require.context('./components', true, /\.vue$/);
const components = {};
componentsContext.keys().forEach(fileName => {
const componentName = fileName.replace(/(^\.\/)|(\.vue$)/g, '');
components[componentName] = componentsContext(fileName).default;
});
export default {
components: components
}