先上结果
vue2 正常返回
vue3 错误返回
index.vue代码
<template>
<view>
</view>
</template>
<script>
export default {
data(){
return {
url:'/douyu/api/room/list'
}
},
mounted() {
this.getData();
},
methods:{
getData(){
uni.request({
url: this.url,
method: 'GET',
data: {
type:'LOL',page:1
},
success: res => {
console.log(res);
},
fail: () => {},
complete: () => {}
});
}
}
}
</script>
<style scoped>
</style>
manifest.json配置
"h5": {
"devServer": {
"proxy": {
"/douyu": {
"target": "https://m.douyu.com",
"changeOrigin": true,
"secure": true,
"pathRewrite": {
"^/douyu": ""
}
}
}
}
}