1.官方推薦cors和插件安裝解決跨域
2.配置uni-app 中 manifest.json->h5->devServer manifest.json
"h5": { "devServer": { "port": 8000, "disableHostCheck": true, "proxy": { "/dpc": { "target": "http://dpc.dapeis.net", "changeOrigin": true, "secure": false } } } }
http請求
uni.request({ url: '/dpc/getUserInfo', success: (res) => { console.log(res.data); }});