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
Author: Guan Changlong is a DBA in the Delivery S...
1. Command Introduction The tac (reverse order of...
Table of contents 1. The difference between funct...
Fabric.js is a very useful canvas operation plug-...
This article shares the specific code of jQuery t...
After studying React for a while, I want to put i...
MySQL is a very powerful relational database. How...
Preface: When you execute a SQL statement in MySQ...
Preface Before we begin, we should briefly unders...
Set vim's working mode (temporary) :set (mode...
I've been learning Docker recently, and I oft...
INSERT INTO hk_test(username, passwd) VALUES (...
The test environment of this experiment: Windows ...
1. Replace your .js library file address with the...
I would like to share the installation and config...