Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the three debugging methods provided by Vue

Shulou Source: shulou.com Published: 2022-06-02 01:46:37 10月10日 Update

This article mainly explains "what are the three debugging methods provided by Vue". The explanation in the article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the three debugging methods provided by Vue?"

Configure debugging in VS Code

When building a project using Vue CLI 2:

Update the devtool property in config/index.js:

Devtool: 'source-map'

Click the Debugger icon in Activity Bar to come to the Debug view:

Select the Chrome/Firefox:Launch environment. Replace the contents of launch.json with:

{"version": "0.2.0", "configurations": [{"type": "chrome", "request": "launch", "name": "vuejs: chrome", "url": "http://localhost:8080"," webRoot ":" ${workspaceFolder} / src "," breakOnLoad ": true "sourceMapPathOverrides": {"webpack:///src/*": "${webRoot} / *"}, {"type": "firefox", "request": "launch", "name": "vuejs: firefox", "url": "http://localhost:8080"," webRoot ":" ${workspaceFolder} / src " "pathMappings": [{"url": "webpack:///src/", "path": "${webRoot} /"}]}

Start debugging:

Set the breakpoint:

# launch Project npm run dev

Select "vuejs:chrome" on the debug page:

II. Debugger statement

Recommend

Function potentiallyBuggyCode () {debugger / / do potentially buggy stuff to examine, step through, etc.}

Browser: F12 opens DevTools, and when running the program, it stops at the debbger statement:

Note: when the Eslint plug-in is installed, click Quick repair, Disable no-debugger for this line. Otherwise, the debugger statement is automatically cleared when it is saved.

III. Vue Devtools

Google browser plug-in.

Thank you for your reading, the above is the content of "what are the three debugging methods provided by Vue". After the study of this article, I believe you have a deeper understanding of what the three debugging methods provided by Vue are, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Mode content statements learning plug-ins browsers projects browsing selection icons that is ideas situations articles breakpoints more environment knowledge knowledge points programs Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux Shulou Technology MariaDB Apple