vscode在vue-cli中按照ESlint自动格式化代码

先安装
1
npm i -S eslint-plugin-vue

.eslintrc下

1
2
3
"plugins": [
    "vue"
]

 vscode首选项 添加

1
2
3
4
5
6
7
8
"eslint.autoFixOnSave"true,
"eslint.validate": [
    "javascript",{
        "language""vue",
        "autoFix"true
    },"html",
    "vue"
],

 当按ctrl+s保存的时候,格式才会发生变化

空格,引号都会变成我们需要的格式

引用https://www.cnblogs.com/anxiaoyu/p/9390280.html

posted @ 2019-02-28 20:16  cxf2018  阅读(310)  评论(0编辑  收藏  举报