Vs code vue template tag formatting

html formatting in vs-code combines the newline writing of tags into one line. For example,
original

<el-dialog 
  title="" 
  :visible.sync="dialogVisible" 
  width="30%" 
  :before-close="handleClose">
</el-dialog>

after formatting

<el-dialog title="" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
</el-dialog>

what is the name of the original HTML writing method first? Then how can I set up the format without changing the original line wrapping
now the prettier, used for formatting seems to be merged with beautify. The setting goes like this:

"vetur.format.defaultFormatter.html": "prettier",

format the format of a line. I don"t think it looks good. Ask for advice


  1. what is the original way of writing HTML called
    html wrap attributes
  2. prettier does not support line break beautification of HTML attributes. See GITHUB discussion 1 , discussion 2
  3. it is recommended to use prettyhtml to complete the formatting you mentioned. The VUE plugin Vetur has built-in formatting of HTML,CSS,JS, etc. By default, the built-in prettyhtml is used to complete HTML formatting. The VSCODE configuration is as follows:

      

    Mark it and ask for the same thing

Menu