In the development process, we often encounter cluttered code and waste a lot of time each time we arrange the code manually. If we can configure the automatic arrangement of the code to make the code pleasant and not waste the time of the arrangement

This is my original messy page

Press the shortcut keys Shift, Alt, f to format the code

Concise and easy


1. Find the vetur in the plug-in application in the vscode editor and install it

Click the last picture on the left to view the existing plug-in. I have added the plug-in of Vetur here. If you don’t have it, you can directly search the above to automatically add it


2, set up

Open the file (file) — — — — – > preferences (preferences) — — — — — – > Settings (set), search vetur. Format. DefaultFormatter. HTML will appear the following options

The default is Prettier

Set the option to JS-beautify – HTML.

On the page you want to format, press the shortcut key: Shift, Alt, F