如何配置 VSCode 中的 settings.json 文件以支持 Vue 开发
时间: 2024-02-21 18:58:19 浏览: 141
要配置 VSCode 中的 settings.json 文件以支持 Vue 开发,可以按照以下步骤操作:
1. 打开 VSCode,点击左侧的“扩展”按钮,搜索并安装“Vetur”插件。
2. 打开 VSCode 的用户设置(快捷键为“Ctrl + ,”),在搜索框中输入“vetur”,找到“Vetur > Language Features > Template Interpolation Service”选项,将其设置为“true”。
3. 在用户设置中搜索“emmet”,找到“Emmet: Include Languages”选项,将其设置为“{ 'vue-html': 'html', 'vue': 'html' }”。
4. 在项目根目录下创建一个名为“.vscode”的文件夹,然后在该文件夹中创建一个名为“settings.json”的文件。
5. 在“settings.json”文件中添加以下配置:
```
{
"vetur.validation.template": false,
"vetur.format.defaultFormatter.html": "prettyhtml",
"vetur.format.defaultFormatter.js": "vscode-typescript",
"vetur.format.defaultFormatterOptions": {
"prettier": {
"singleQuote": true,
"semi": false
}
},
"vetur.format.options.useTabs": true,
"emmet.syntaxProfiles": {
"vue-html": "html",
"vue": "html"
}
}
```
6. 保存“settings.json”文件后,重新打开 VSCode,就可以正常使用 Vue 开发了。
希望这个回答能够帮到你!
阅读全文
相关推荐


















