文件—>首选项—>设置—>右上侧打开设置(json),在setting.json里面放进去,保存,重启vscode
{
"files.autoSave": "afterDelay", //自动保存
"editor.detectIndentation": false, //缩进
"editor.tabSize": 2,
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll": true,
},
"prettier.semi": false,
"prettier.singleQuote": true,
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.validation.template": false,
"vetur.format.options.tabSize": 2,
"wxmlConfig.onSaveFormat": true,
"vetur.format.defaultFormatterOptions": {
"prettyhtml": {
"printWidth": 300, // No line exceeds 300 characters
"singleQuote": false // Prefer double quotes over single quotes
},
"prettier": {
"semi": false,
"singleQuote": true
},
"js-beautify-html": {
"wrap_attributes": "auto",
}
},
"vsicons.dontShowNewVersionMessage": true,
"eslint.enable": false,
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"[javascript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"emmet.syntaxProfiles": {},
"easysass.formats": [
{
"format": "expanded",
"extension": ".css"
},
{
"format": "compressed",
"extension": ".min.css"
}
],
"[jsonc]": {
"editor.defaultFormatter": "vscode.json-language-features"
},
}