vscode加快开发速度的常用代码片段

在user snippets中的vue.json中配置常用的代码片段(持续更新中)

javascript 复制代码
{
  "Print to console": {
    "prefix": "log",
    "body": ["console.log('$1');", "$2"],
    "description": "Log output to console"
  },
  "vue3 component": {
    "prefix": "vue3",
    "body": [
      "<template>",
      "  <div $1></div>",
      "</template>",
      "",
      "<script setup>",
      "import { ref, onMounted } from 'vue';",
      "import { useRoute, useRouter } from 'vue-router';",
      "const route = useRoute();",
      "const router = useRouter();",
      "onMounted(() => {",
      "  //console.log('3.-组件挂载到页面之后执行-------onMounted')",
      "})",
      "</script>",
      "<style scoped lang='scss'>",
      "</style>"
    ],
    "description": "vue3的代码片段"
  },
  "function comment": {
    "prefix": "funccomment",
    "body": [
      "/**",
      " * $1",
      " * $2",
      " *",
      " * @param  $3  $4  $5",
      " * @param  $6  $7  $8",
      " * @returns $9",
      " */"
    ],
    "description": "Add function comment"
  },
  "page comment": {
    "prefix": "pagecomment",
    "body": [
		"<!--",
		"  Author: Your Name",
		"  Last Modified: 2023-11-06",
		"  Description: Vue Component",
		"-->",
    ],
    "description": "Add function comment"
  },
  "vue2 component": {
	"prefix": "vue2",
	"body": [
	  "<template>",
	  "  <div>",
	  "    $1",
	  "  </div>",
	  "</template>",
	  "",
	  "<script>",
	  "export default {",
	  "  data() {",
	  "    return {",
	  "      $2",
	  "    }",
	  "  },",
	  "  methods: {",
	  "    $3",
	  "  }",
	  "}",
	  "</script>",
	  "",
	  "<style scoped>",
	  "  $4",
	  "</style>"
	]
  },
  "JavaScript If Statement": {
	"prefix": "if",
	"body": [
	  "if ($1) {",
	  "  $2",
	  "}"
	],
	"description": "JavaScript If Statement"
  }
  
}
相关推荐
电子云与长程纠缠1 小时前
UE5.3中通过编辑器工具创建大纲菜单文件夹
java·ue5·编辑器
会发光的猪。1 小时前
如何在vscode中安装git详细新手教程
前端·ide·git·vscode
lucky九年2 小时前
vscode翻译插件
ide·vscode·编辑器
帅得不敢出门2 小时前
Gradle命令编译Android Studio工程项目并签名
android·ide·android studio·gradlew
ZHOUPUYU3 小时前
IntelliJ IDEA超详细下载安装教程(附安装包)
java·ide·intellij-idea
真·Wild·攻城狮3 小时前
【码农日常】Vscode Clangd初始化失败(Win10)
ide·vscode·编辑器
小堇不是码农3 小时前
在VScode中配置C_C++环境
c语言·c++·vscode
七灵微3 小时前
【测试】【Debug】vscode中同一个测试用例出现重复
ide·vscode·编辑器
哇咔咔哇咔17 小时前
使用Markdown编写适用于GitHub的README.md文件的目录结构
vscode·markdown
Rverdoser18 小时前
Android Studio 多工程公用module引用
android·ide·android studio