有的时候博客内容会有变动,首发博客是最新的,其他博客地址可能会未同步,认准https://blog.zysicyj.top

首发博客地址

全网最细面试题手册,支持艾宾浩斯记忆法


如果后端接口没有设置 cors (跨域资源共享),可在前端解决跨域问题,在 vue.config.js 中配置代理:

  devServer: {
    client: {
        overlay: false
    },
    historyApiFallback:true,
        allowedHosts:'all',
        port: 8080,
        proxy: {
        '/api': {
            // target:"http://172.29.133.140:8081/api",
            // target: 'http://127.0.0.1:8081',
            // target: 'http://172.40.236.81:8907',//网关 gqc
            target: 'http://172.29.133.135:8081/api',
                // target: 'http://172.29.133.137:8081/api',//陆强
                //target: 'http://172.29.132.54:8081/api',//吕世建
                // target: 'http://172.29.131.100:8081/api',//于勇
                //target: 'http://172.29.131.26:8081/api',//双双
                //  target:"http://172.29.131.26:8081",
                // target:"http://172.29.133.135:8080",
                pathRewrite: {
                '^/api': ''
            }
        }
    }
}

然后修改 .env 、 .env.development 文件中的下面这行代码,修改后需要重新运行项目:

VUE_APP_API_BASE_URL=/api

本文由mdnice多平台发布


朱永胜
20 声望5 粉丝