1.左下隅の設定ボタンをクリックし、[設定]を選択します
2.ユーザー設定でveturを見つけ、settings.jsonで[編集]をクリックします
3.次の構成を設定します
{
"[vue]": {
"editor.defaultFormatter": "octref.vetur"
},
"vetur.format.defaultFormatter.html": "js-beautify-html", // html不换行,格式化模板选择为:js-beautify-html
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "auto",// html 标签属性 换行设置[auto|force|force-aligned|force-expand-multiline] ["auto"]
"end_with_newline": false // 在文件结尾添加新行
},
"prettyhtml": {
"printWidth": 100,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
},
"vetur.grammar.customBlocks": {
"docs": "md",
"i18n": "json"
}
}