vue.config.js文件作如下处理:
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
outputDir: 'dist',
devServer: {
open: true,
proxy: {
'/api': {
target: 'http://test.aaa.com',
pathRewrite: { '^/api': '' }, // 路径改写
changeOrigin: true,
ws: true
}
}
}
})
配置接口域名的文件做如下处理:
clusterApi = 'http://localhost:8080/api'