最新VSCode格式化代码不换行
安装Vetur插件
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210712154205349.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pvdWh1dQ==,size_16,color_FFFFFF,t_70)
设置
- 打开设置
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210712154506324.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pvdWh1dQ==,size_16,color_FFFFFF,t_70) - 搜索 打开 配置 settings.json 文件
vetur.format.defaultFormatterOptions ![在这里插入图片描述](https://img-blog.csdnimg.cn/20210712154616558.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pvdWh1dQ==,size_16,color_FFFFFF,t_70) - 输入下面内容
![在这里插入图片描述](https://img-blog.csdnimg.cn/20210712154842708.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pvdWh1dQ==,size_16,color_FFFFFF,t_70)
{
"workbench.iconTheme": "material-icon-theme",
"workbench.colorTheme": "Default Dark+",
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_line_length": 240,
"wrap_attributes": "auto",
"end_width_newline": false
},
"prettyhtml": {
"printWidth": 100,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
}
完美解决
舒服多了 ![在这里插入图片描述](https://img-blog.csdnimg.cn/2021071215494934.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3pvdWh1dQ==,size_16,color_FFFFFF,t_70)
|