vConsole
vConsole is a lightweight, extensible debugging panel for front-end developers. It is specially designed for mobile web pages to help developers carry out development and debugging work more conveniently.
Features are as follows:
View console logs
View network requests
Manually execute JS command line
use
-
Install
npm install -D vconsole
-
Create a utils folder in the src/assets directory and create a new file vconsole.js in it
import Vconsole from 'vconsole'
export default new Vconsole()
- Reference, can be referenced globally in main.js
if (process.env.VUE_APP_MODE !== 'production') {
require('@/assets/utils/vconsole')
}
- The vconsole control will appear on the startup project page.
5.Principle
(1) Rewrite the console
(2) Use window.onerror to capture and report Js errors