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"
  }
  
}
相关推荐
xqlily2 小时前
通过 Visual Studio Code 启动 IPython
ide·vscode·ipython
练小杰4 小时前
Linux系统 C/C++编程基础——基于Qt的图形用户界面编程
linux·c语言·c++·经验分享·qt·学习·编辑器
梓沂4 小时前
idea修改模块名导致程序编译出错
java·ide·intellij-idea
千航@abc6 小时前
vim在末行模式下的删除功能
linux·编辑器·vim
dot.Net安全矩阵6 小时前
拒绝 Github 投毒,通过 Sharp4SuoBrowser 分析 Visual Studio 隐藏文件
ide·安全·web安全·github·.net·.netcore·visual studio
江西理工大学小杨7 小时前
VScode连接远程Linux服务器环境配置
ide·vscode·编辑器
莲动渔舟11 小时前
国产编辑器EverEdit - 命令窗口应用详解
编辑器·emeditor·everedit
aloneboyooo12 小时前
Android Studio安装配置
android·ide·android studio
梓懿lwh13 小时前
vim的介绍
linux·编辑器·vim
涛ing14 小时前
23. C语言 文件操作详解
java·linux·c语言·开发语言·c++·vscode·vim