fetch交互

// fetch实现跨域
created () {
// fetch方式实现跨域
/*fetch('/api/user/getUser', {
method: 'POST',
mode: 'cors',
credentials: 'include',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ id: 3 })
}).then(res => {
console.log(res)
})*/
}

posted @ 2020-04-28 18:17  huanglongblog  阅读(129)  评论(0编辑  收藏  举报