请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

老师你好,Vetur在保存代码的时候自动添加了逗号分号报错怎么办?

图片描述

下面是Vetur的配置文件:

{
    "[c]": {},
    "editor.suggestSelection": "first",
    "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "code-runner.clearPreviousOutput": true,
    "emmet.includeLanguages": {
        "wxml": "html"
    },
    "editor.formatOnType": true,
    "editor.formatOnSave": true,
    "editor.fontLigatures": false, 
    "editor.mouseWheelZoom": true,
    "java.configuration.checkProjectSettingsExclusions": false,
    "java.semanticHighlighting.enabled": true,
    "cssrem.rootFontSize": 33,
    "C_Cpp.updateChannel": "Insiders",
    "files.associations": {
        "*.cjson": "jsonc",
        "*.wxss": "css",
        "*.wxs": "javascript"
    },
    "minapp-vscode.disableAutoConfig": true,
    "workbench.colorTheme": "One Dark Pro Flat",
    "editor.tabSize": 2,
    "workbench.editorAssociations": {
        "*.ipynb": "jupyter.notebook.ipynb"
    },
    "workbench.iconTheme": "vscode-great-icons",
    "liveServer.settings.donotShowInfoMsg": true,
    "javascript.validate.enable": false,
    "liveServer.settings.CustomBrowser": "chrome",
    "vetur.validation.template": false,
    "vetur.completion.scaffoldSnippetSources": {

        "workspace": "💼",
        "user": "🗒️",
        "vetur": "✌"
    },
    "vetur.experimental.templateInterpolationService": true,
    "editor.codeActionsOnSave": {},
    "vetur.format.defaultFormatterOptions": {

        "js-beautify-html": {
            "wrap_attributes": "force-expand-multiline"
        },
        "prettyhtml": {
            "printWidth": 100,
            "singleQuote": false,
            "wrapAttributes": false,
            "sortAttributes": false
        }
    },
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    }
}

正在回答 回答被采纳积分+3

1回答

张轩 2021-08-14 09:33:56

同学你好 这是因为设置了 prettier 自动格式化代码,但是 prettier 和 eslint 格式冲突所造成的。可以这样取消下 prettier 的配置

将 以下这些都删除掉就好了
    "editor.codeActionsOnSave": {},
    "vetur.format.defaultFormatterOptions": {

        "js-beautify-html": {
            "wrap_attributes": "force-expand-multiline"
        },
        "prettyhtml": {
            "printWidth": 100,
            "singleQuote": false,
            "wrapAttributes": false,
            "sortAttributes": false
        }
    },
    "[vue]": {
        "editor.defaultFormatter": "esbenp.prettier-vscode"
    }


0 回复 有任何疑惑可以回复我~
  • 提问者 coderwm #1
    老师,感谢你的回复,按照你说的方法进行了操作。但是自动保存还是有分号。
    我从网上找几个解决方案试了一下。加上下面两条配置。再自动保存的时候就没有分号了。
     "vetur.format.defaultFormatter.ts": "vscode-typescript", 
     "vetur.format.defaultFormatter.js": "vscode-typescript"
    回复 有任何疑惑可以回复我~ 2021-08-14 12:10:41
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信