vue3中用ajax发送一个http请求,怎么配置跨域
如图所示,我在页面函数中直接用ajax post了一个网址,但是报错
是跨域的问题,要到vue.config.js中去配置,网上搜了一大堆,就是没有说该怎么写的
这是项目中的vue.config.js
所以我该怎么样才能让我函数中的ajax请求发出去,感谢
const reloadFace = (arr) => {
arr.map((url) => {
console.log('重载人脸', url)
axios.post(url + '?restore', {})
.then(response => {
console.log(response.data)
})
.catch(error => {
console.log(error)
})
})
}