uni-app配置跨域后请求下来的数据乱了?-灵析社区

万码EZQPETUV

网址如下浏览器直接打开能获取到数据 ![https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724816694219_MW4I.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724816694219_MW4I.png) 配置跨域 ![https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724816601175_6PC4.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724816601175_6PC4.png)! 请求数据 ![https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724816671511_FBm7.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724816671511_FBm7.png) 浏览器输出结果 ![https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724816644423_hihF.png](https://wmprod.oss-cn-shanghai.aliyuncs.com/community/1724816644423_hihF.png) 我哪里整错了吗。。。 相关代码 ``` language "h5" : { "router" : { "base" : "" }, "template" : "", "devServer": { "port": 8000, "disableHostCheck": true, "proxy": { "/hlp": { "target": "https://api.1hudoctor.com", "changeOrigin": true, "secure": false } } } } ``` ``` language uni.request({ url: '/hlp/meta?m=city&platform=customer&device_type=miniApp_yihuundefined', dataType:"json", success: (res) => { console.log(res); } }); ```

阅读量:172

点赞量:0

问AI
什么都不变,请求数据的时候还是把全路径写进去: uni.request({ url: '/hlp/https://api.1hudoctor.com/meta?m=city&platform=customer&device_type=miniApp_yihuundefined', // data:{ // m: 'city', // platform: 'customer', // device_type: 'miniApp_yihuundefined' // }, // dataType:"json", success: (res) => { console.log(res); // uni.showToast({ // title:res // }) } });