1. Introduction Many times we need to debug the front end, that is, debug the interaction between the front-end and back-end interfaces. The common way is to log, such as This method is actually OK for a single method, but for multiple interfaces and methods, this debugging method is a little worse. Also, methods have an execution order, which sometimes affects debugging. 2. Use axios interceptor to print front-end logs This is a more recommended method, that is, write it once and you don’t have to write Suddenly I thought of a sentence I often saw when doing tests:
To paraphrase this sentence, it's all about debugging. 1. Modify main.ts Modify main.ts and add the following content: html /** * axios interceptor */ axios.interceptors.request.use(function (config) { console.log('Request parameters:', config); return config; }, error => { return Promise.reject(error); }); axios.interceptors.response.use(function (response) { console.log('Return result:', response); return response; }, error => { console.log('Return error:', error); return Promise.reject(error); }); 2. Delete all console.log in home 3. Recompile and start again Check the results as shown below: This is the end of this article about Vue3 using axios interceptor to print front-end logs. For more relevant Vue3 using axios interceptor to print front-end logs, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: 3 ways to add links to HTML select tags
>>: How to choose between MySQL CHAR and VARCHAR
<br /> Note: All texts, except those indicat...
Prerequisites Compose is a tool for orchestrating...
Introduction: This article takes the sample proje...
Hello everyone, I am Liang Xu. As we all know, in...
Git is integrated in vscode, and many operations ...
Preface Since vue3.0 was officially launched, man...
First of all, the blogger is playing the communit...
In the previous article, we talked about MySQL tr...
Mybatis paging plug-in pageHelper detailed explan...
The difference between inline elements and block-...
Docker Installation curl -fsSL https://get.docker...
Remove the dotted box on the link Copy code The co...
Moreover, an article website built with a blog pro...
Deepin 2014 download and installation For downloa...