标签:import vendor div component span comm mon 开始 exports
打开build/webpack.base.conf.js
找到module.exports下的resolve这行
刚开始是这样的
resolve: { extensions: [‘.js‘, ‘.vue‘, ‘.json‘], alias: { ‘vue$‘: ‘vue/dist/vue.esm.js‘, ‘@‘: resolve(‘src‘), } },
改成:
resolve: { extensions: [‘.js‘, ‘.vue‘, ‘.json‘], alias: { ‘vue$‘: ‘vue/dist/vue.esm.js‘, ‘@‘: resolve(‘src‘), ‘src‘: path.resolve(__dirname, ‘../src‘), ‘pages‘: path.resolve(__dirname, ‘../src/pages‘), ‘common‘: path.resolve(__dirname, ‘../src/common‘), ‘vendor‘: path.resolve(__dirname, ‘../src/vendor‘), ‘components‘: path.resolve(__dirname, ‘../src/components‘), } },
然后你就可以在任意.vue文件,使用import xxxComponent from ‘components/xxxComponent‘
标签:import vendor div component span comm mon 开始 exports
原文地址:http://www.cnblogs.com/zph666/p/7776696.html