1.关闭Eslint校验及配置代理跨域
在根目录下新建vue.config.js文件
module.exports = {
// 关闭eslint
lintOnSave: false,
// 代理跨域
devServer: {
proxy: {
"/api": {
target: "http://123.60.146.14", // 接口服务器地址
// pathRewrite: { "^/api": "" },
},
},
},
};
2.设置别名
在根目录下新建jsconfig.json文件
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["src/*"] // 配置别名,@代表src文件夹
},
"exclude": ["node_modules", "dist"] // 忽略从以下文件夹查找
}
}