前端打包前的配置url
1. 如果是 abc.com/
publicPath: './'
请求的接口需要配置代理
devServer: {
hot:true,//热更新
open:true,//build自动打开浏览器
//host:默认lolaohost,也可0.0.0.0,这样同一网段的主机都能通过ip访问
port:7777,//访问项目时的端口号
proxy:{
//代理名称
'/abc': { //这里最好有一个 /
target: 'https://abc.com', // 后台接口域名
changeOrigin: true, //是否跨域
//路径重写
pathRewrite:{
'^/abc':''"
}
},
}
},
2. 如果是 abc.com/adc
就需要配置
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
lintOnSave: false, 取消eslint 的检查
publicPath: '/adc'
})

浙公网安备 33010602011771号