1.Vetur(VScode 上 Vue 工具)官方推薦,作用:高亮.VUE文件,附帶有格式化功能,配合Eslint插件對代碼進行格式化檢查。
2.Eslint+Prettier(規范代碼工具)檢查你的js、html、css代碼,確保它們符合規范。
3.打開設置界面:VS Code 文件 > 首選項 > 設置,點擊右上角,進行設置
{ // prettier:每行在這個字符數內整合代碼,如果你的屏幕較寬分辨率較高可以適當加大 "prettier.printWidth": 120, // prettier:是否在每行末尾加上分號 "prettier.semi": false, // prettier:如果為true,將使用單行否則使用雙引號 "prettier.singleQuote": true, // vetur:對html的內容使用js-beautify-html "vetur.format.defaultFormatter.html": "js-beautify-html", "files.autoSave":"off", "emmet.syntaxProfiles": { "vue-html": "html", "vue": "html" }, "eslint.validate": [ "javascript", "javascriptreact", "html", { "language": "vue", "autoFix": true } ], "eslint.options": { "plugins": ["html"] } }