vue.js axios call api example


代码样例:

 

 

 code:

let url = '/api/xxx/yyy';
            let paramObj = JSON.stringify(
                {
                }
            );
            axios
                .post(url,
                    paramObj,
                    {
                        headers: {
                            'Content-Type': 'application/json; charset=utf-8'
                        }
                    })
                .then(response => {
                    if (response.data.ResponseStatus) {
                        //do success coding...
                    }
                    else {
                        //do fail coding...
                    }
                })
                .catch(error => {
                    console.log(error)
                })
                .finally(() => {
                    //do something...
                })
Source Code

 

posted @ 2021-06-27 08:38  Insus.NET  阅读(124)  评论(0编辑  收藏  举报