在 vue.config.js 文件中:
let path = require('path')
module.exports = {
// devServer: {
// proxy: {
// '/api': {
// target: 'http://localhost:3000', //后台服务器地址,跨域请求的公共地址
// changeOrigin: true, //target为域名时必须设置此项
// secure: false, //设置支持 https 协议的代理
// pathRewrite: {
// '^/httpServer': 'http://localhost:3000', //本地地址
// },
// },
// },
// },
configureWebpack: (config) => {
config.resolve = {
extensions: ['.js', '.json', '.vue'],
alias: {
'@': path.resolve(__dirname, './src'),
},
}
},
}
使用:
import '@/assets/css/common.css'