Skip to content

大佬,这个项目怎么做跨域处理,添加了跨域配置好像不生效 #1

@mingzhu02

Description

@mingzhu02

vue.config.js
// vue.config.js
module.exports = {
// webpack-dev-server 相关配置
devServer: {
// 调试端口
// port: 8989
port: 8085, // 端口号
host: 'localhost',
https: false, // https:{type:Boolean}
open: true, //配置自动启动浏览器
proxyTable: {
'/api': {
target: 'xxxxx', // 接口的域名
// secure: false, // 如果是https接口,需要配置这个参数
changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
pathRewrite: {
'^/api': ''
}
}
},
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions