小编是在项目的vue.config.js中配置的,代码如下图所示:
//安装path模块
const path = require("path");
function resolve(dir) {
return path.join(__dirname, dir);
}
module.exports={
devServer:{},
chainWebpack: (config) => {
config.resolve.alias
.set("@", resolve("src"))
.set("@u", resolve("src/utils"));
},
}