Vscode configures the code format of Vue project

  1. Install the plug-in vetur first
  2. settings.json It is amended as follows:
    "vetur.format.defaultFormatter.html": "prettyhtml",
     "vetur.format.defaultFormatterOptions": {
         "prettyhtml": {
             "Printwidth": 100, // 100 characters per line
             "Singlequote": false // force single quotation to double quotation
  3. Format code: Shift + Alt + F

Summary: settings.json The configuration of is only for the HTML part, JS part is still not perfect, I don’t know if there is a better solution?

This work adoptsCC agreementReprint must indicate the author and the link of this article