axios使用

    技术2024-12-23  15

    详细方式参考

     https://www.npmjs.com/package/axios

    cnd方式引入 (https://www.bootcdn.cn/axios/)

    <script src="https://cdn.bootcss.com/axios/0.19.2/axios.min.js"></script>

    更多例子 https://gitee.com/zhangsike/javaSummary/blob/master/vue/axios使用说明.md

    get请求

    方式一 axios.get('/user?ID=12345') .then(function (response) { // handle success console.log("success:"+response.status+","+JSON.stringify(response.data)); }) .catch(function (error) { // handle error console.log(error); }) .finally(function () { // always executed }); // 方式二 axios.get('/user', { params: { ID: 12345 } }) .then(function (response) { console.log(response); }) .catch(function (error) { console.log(error); }) .finally(function () { // always executed });

     

    Processed: 0.039, SQL: 9