VsCode设置vue文件换行问题


问题

使用vscode编辑vue文件的时候,会使用vetur。它默认的配置的换行机制尤其是js的换行比如下图,让人感觉有点不舒服

解决方案

选择 文件->首选项->设置 或者直接打开 setting.json, 进行下面的配置即可

"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.js": "vscode-typescript", //js不换行
"vetur.format.defaultFormatter.ts": "vscode-typescript", // ts不换行
"vetur.format.defaultFormatterOptions": {
    "prettier": {
    "singleQuote": true
    },
    "js-beautify-html": {
        "wrap_attributes": "auto" // auto是html部分不换行; force-expand-multiline是换行
    },
    "prettyhtml": {
        "printWidth": 100,
        "singleQuote": false,
        "wrapAttributes": false,
        "sortAttributes": false
    }
}

VsCode怎么打开setting.json?

左下角设置 -> 设置 -> 搜索 Edit in settings.json 就可以看到了


文章作者: zxc
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 zxc !
 上一篇
the 'scope' attribute for scoped slots have been deprecated and replaced by 'slot-scope' since 2.5 the 'scope' attribute for scoped slots have been deprecated and replaced by 'slot-scope' since 2.5
the ‘scope’ attribute for scoped slots have been deprecated and replaced by ‘slot-scope’ since 2.5具体信息(Emitted value ins
2020-12-30
下一篇 
MarkDown基本语法 MarkDown基本语法
一.标题一个#是以及标题 两个#是二级标题 一次类推 支持六级 # 标题 标题## 标题 标题### 标题 标题#### 标题 标题##### 标题 标题###### 标题 标题 二.字体 斜体 一个*包围*这是斜体* 这是
2020-10-19
  目录