乐趣区

关于visual-studio-code:VS-Code环境配置Vue篇

在 VS Code 中,配置适宜 Vue 的开发环境;
装置 prettier 插件, 并且在 settings.json 中, 做出如下配置

settings.json 配置

// 编辑器设置
"editor.tabSize": 2,
"editor.fontLigatures": true,
"editor.formatOnSave": true,
"editor.renderWhitespace": "none",
"editor.renderControlCharacters": false,
"editor.codeActionsOnSave": {"source.fixAll.eslint": true},
"diffEditor.ignoreTrimWhitespace": false,
"terminal.integrated.rendererType": "dom",
"window.zoomLevel": 0,
"minapp-vscode.disableAutoConfig": true,

// 代码格式化设置
"prettier.semi": false,
"prettier.singleQuote": true,
"prettier.trailingComma": "all",
"prettier.arrowParens": "avoid",
"prettier.endOfLine": "auto",
// 配置 js 的文档格式化工具
"": {"editor.defaultFormatter":"esbenp.prettier-vscode"},"[vue]": {"editor.defaultFormatter":"esbenp.prettier-vscode"},"vetur.format.defaultFormatterOptions": {
// vetur 新版本不会读取 prettier 的配置, 须要在这里设置
"prettier": {
"singleQuote": true,
"semi": false,
"trailingComma": "all"
}
},
"emmet.includeLanguages": {"wxml": "html"},
"javascript.implicitProjectConfig.experimentalDecorators": true,
"css.fileExtensions": ["css", "scss", "vue"],
"files.associations": {
"*.cjson": "jsonc",
"*.wxss": "css",
"*.wxs": "javascript"
},

.prettierrc 配置

{
 "eslintIntegration": true,
 "singleQuote": true,
 "semi": false,
 "trailingComma": "all"
}
退出移动版