项目要注意保存、重启,不知道什么原因项目改完后没起作用,写对了但总是失败·,最后保存重启就成功了。
添加代码块:
我这里用的是 https://
"h5" : {
"title" : "Test",
"devServer": {
"port": 8080,
"disableHostCheck": true,
"proxy": {
"/": {
"target": "https://自己的域名.cn",
"changeOrigin": true,
"secure": false,
"pathRewrite": {
"^/": "/"
}
}
}
}
}
调用:
将原本的 'https://自己的域名.cn/agentkit-auth/oauth/token' +obj
改为 '/agentkit-auth/oauth/token' + obj
export function loginByUsername(obj) {
return http.request({
url: '/agentkit-auth/oauth/token' + obj,
method: 'POST'
})
}
结果: