.vscode 扩展配置

一、vue快捷键配置

在项目.vscode下新建vue3.0.code-snippets

每当输入vue3.0后自动生成代码片段

复制代码
{
  "Vue3.0快速生成模板": {
    "scope": "vue",
    "prefix": "Vue3.0",
    "body": [
      "<template>",
      "  <div>${1:test}</div>",
      "</template>",
      "",
      "<script lang=\"ts\">",
      "export default {",
      "  setup() {",
      "    return {};",
      "  },",
      "};",
      "</script>",
      "",
      "<style lang=\"scss\" scoped></style>",
      ""
    ],
    "description": "Vue3.0"
  }
}

vue3.2.code-snippets

复制代码
{
  "Vue3.2+快速生成模板": {
    "scope": "vue",
    "prefix": "Vue3.2+",
    "body": [
      "<script setup lang=\"ts\"></script>",
      "",
      "<template>",
      "  <div>${1:test}</div>",
      "</template>",
      "",
      "<style lang=\"scss\" scoped></style>",
      ""
    ],
    "description": "Vue3.2+"
  }
}

vue3.3.code-snippets

复制代码
{
  "Vue3.3+defineOptions快速生成模板": {
    "scope": "vue",
    "prefix": "Vue3.3+",
    "body": [
      "<script setup lang=\"ts\">",
      "defineOptions({",
      "  name: \"\",",
      "});",
      "</script>",
      "",
      "<template>",
      "  <div>${1:test}</div>",
      "</template>",
      "",
      "<style lang=\"scss\" scoped></style>",
      ""
    ],
    "description": "Vue3.3+defineOptions快速生成模板"
  }
}

二、自动调用.prettierrc格式化代码

settings.json

复制代码
{
  "editor.formatOnSave": true, // 保存格式化文件
  "editor.defaultFormatter": "esbenp.prettier-vscode" // 指定 prettier 为所有文件默认格式化器
}
相关推荐
acanab1 小时前
VScode python插件
ide·vscode·python
C+++Python8 小时前
Visual Studio Code(简称 VS Code)免费编辑器安装和软件配置 步骤
vscode
claider8 小时前
Vim User Manual 阅读笔记 Usr_05.txt Set your settings 设置你的设置
笔记·编辑器·vim
海棠AI实验室9 小时前
第七章 断点调试:VSCode 调试全流程(含常见坑)
ide·vscode·编辑器
淮北4949 小时前
通过VSCODE下在markdown插件编辑查看
ide·vscode·编辑器
多看书少吃饭12 小时前
OnlyOffice 编辑器的实现及使用
前端·vue.js·编辑器
小小代码狗12 小时前
VS中配置php的保姆级教程
vscode·php
小新ya12 小时前
vscode增删改查文件,一直等待中...
linux·vscode
HealthScience13 小时前
常见的微调的方式有哪些?(Lora...)
vscode·python