引用:axios.js文件
<script src="../../new/js/axios.min.js"></script>
https://unpkg.com/axios@1.4.0/dist/axios.min.jshttps://unpkg.com/axios@1.4.0/dist/axios.min.jsGET:
mounted() {
axios.get('http://localhost:8080/******/*******', {
params: {
//参数ID
}
})
.then(function (response) { //请求成功
console.log(response);
console.log(response.data.data);
})
.catch(function (error) { //请求失败
console.log(error);
});
},
POST:
mounted() {
axios.post('http://localhost:8080/******/*******', {
params: {
//参数ID
}
})
.then(function (response) { //请求成功
console.log(response);
console.log(response.data.data);
})
.catch(function (error) { //请求失败
console.log(error);
});
},