开发过程中发现,格式化vue文件时总是不生效,本人通过以下方法已解决了原来的问题。
在文件==》首选项==》设置==》用户设置当中,放入以下代码即可。

{ "window.title": "${dirty}${activeEditorLong}${separator}${rootName}${separator}${appName}",
"window.zoomLevel": 0,
"workbench.colorTheme": "Default Light+",
"extensions.ignoreRecommendations": true,
"emmet.syntaxProfiles": {
"vue-html": "html",
"vue": "html"
},
"vetur.validation.template": false,
"eslint.options": {
"plugins": ["html"]
},
"eslint.validate": [
"javascript",
"javascriptreact",
"html",
"vue"
],
"prettier.singleQuote": true,
"prettier.semi": false,
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatterOptions": {
"wrap_attributes": "force-expand-multiline"
// "js-beautify-html": {
// "wrap_attributes": "force-expand-multiline",
// "end_with_newline": false
// }
}
}
其中wrap_attributes
属性设置了格式化代码时的换行规则,
比如当某标签的属性过多时,不想放在同一行中,就可以设置其属性值为force-expand-multiline。
其他可选值为: [auto|force|force-aligned|force-expand-multiline] ["auto"]
网友评论