let btn = document.querySelector('button')
//fetch 是原生 js 代码
//fetch 是在promise的基础上 实现的
btn.onclick = function () {
fetch('http://localhost:3000/useing/master', {
method: 'get'
})
.then(res => res.json())
.then(res => {
console.log(res);
})
}
fetch的基本用法 代码
最新推荐文章于 2023-05-21 20:14:04 发布