
还有我在 vue.config.js 中配置的跨域配置, 我们已经重写了路径, 为什么在请求时还包含了 /api 字符串
ENV = 'development'
VUE_APP_BASE_API = '/api'
const instance = axios.create({
baseURL: process.env.VUE_APP_BASE_API,
timeout: '5000'
})
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true,
devServer: {
proxy: {
'/api': {
target: 'https://apis.imooc.com',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}
}
})