<script>
// 参数 params
// 数据 .data
axios.get("./00 data.json",{
// Headers:{
// },
params:{
id:1001
}
})
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.log(error);
})
</script>
<script>
// 参数then response
// 数据then data
//原生JavaScript 不需要引入任何东西
fetch('./00 data.json')
.then(function (response) {
//固定写法
console.log(response)
//resolve
return response.json();
})
.then(function (myJson) {
console.log(myJson);
})
.catch(function () {
//reject
});
</script>
浙公网安备 33010602011771号