vue:配置路径别名、路径简写
在vue.config.js文件中做以下配置:
const path=require('path')
module.exports = {
chainWebpack:config=>{
config.resolve.alias
.set('cp',path.resolve(__dirname,'./src/components'))
.set('as',path.resolve(__dirname,'./src/assets'))
.set('page',path.resolve(__dirname,'./src/views'))
},
}
cp是路径“./src/components”的路径简写(路径别名),下面两个同理