vs code 代码格式化文件
操作步骤:
- 选择左下角settings
- 选择右上角 open settings
3.将js复制到其中即可
{
"vetur.format.options.tabSize": 2,
"vetur.format.options.useTabs": false,
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.js": "vscode-typ=script",
"vetur.format.defaultFormatterOptions": {
"prettyhtml": {
"printWidth": 120, // No line exceeds 100 characters
"singleQuote": false // Prefer double quotes over single quotes
},
"js-beautify-html": {
"wrap_attributes": "auto",
"wrap_attributes_mode": "auto",
"wrap-line-length": 320,
"wrapped_attributes_per_line": "multiple",
"wrapped_attributes_indent": "auto",
"wrapped_attributes_end": "auto"
}
},
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"explorer.confirmDelete": false,
"files.associations": {
"*.js": "html"
}
}