1.首先安装vetur
2.然后配置vscode的设置项,如下
{
"explorer.confirmDragAndDrop": true, // 当拖动一个文件或者文件夹到另一个文件夹时,是否启动提示
"editor.fontSize": 14, // 设置编辑器字体大小
"editor.tabSize": 2, // 设置编辑器一个tab占多少个空格
"editor.renderWhitespace": "all", // 空格是否显示
"editor.lineHeight": 20, // 编辑器行高
"javascript.implicitProjectConfig.experimentalDecorators": true, // 使用vscode编辑器出现,experimentaldecorators报错
"window.zoomLevel": 0, // Adjust the zoom level of the window
"editor.detectIndentation": false, // When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
"typescript.updateImportsOnFileMove.enabled": "always", // Enable/disable automatic updating of import paths when you rename or move a file in VS Code. Possible values are: 'prompt' on each rename, 'always' update paths automatically, and 'never' rename paths and don't prompt me. Requires TypeScript >= 2.9
"files.autoSave": "onFocusChange",
"vetur.format.defaultFormatter": {
"html": "prettier",
"css": "prettier",
"postcss": "prettier",
"scss": "prettier",
"less": "prettier",
"js": "prettier",
"ts": "prettier",
"stylus": "stylus-supremacy"
}
}
提示不存在配置别管,照配
如果要配置格式化选项,那么需要新增一个文件
.prettierrc
具体格式规则在下面配置就行了,如下
{
"semi": false,
"overrides": [
{
"files": "*.test.js",
"options": {
"semi": true
}
}
]
}
网友评论