jeecg配置跨域

333 阅读1分钟

vue.config.js

 '/qq': {
        target: 'https://apis.map.qq.com/', // 这里后台的地址模拟的;应该填写你们真实的后台接口 
        ws: true,
        changOrigin: true, // 允许跨域
        pathRewrite: {
          '^/qq': '' // 请求的时候使用这个api就可以
        }}

页面内

//实际会把/qq替换成https://apis.map.qq.com/
let res = await this.get('/qq/ws/geocoder/v1')