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"
  }
  
}
相关推荐
weixin_431449681 小时前
web组态软件
前端·物联网·低代码·编辑器·组态
SiMmming7 小时前
从0到1部署Tomcat和添加servlet(IDEA2024最新版详细教程)
java·ide·tomcat·intellij-idea·web
豆包MarsCode10 小时前
我用豆包MarsCode IDE 做了一个 CSS 权重小组件
开发语言·前端·javascript·css·ide·html
0zxm10 小时前
01.Django快速入门
数据库·vscode·python·django·sqlite
小阿龙...10 小时前
创建mapreduce项目使用maven
java·ide·hadoop·spark·big data
誓约酱11 小时前
(动画)Qt控件 QLCDNumer
开发语言·c++·git·qt·编辑器
Spiffo_Sir13 小时前
【Spiffo】环境配置:VScode+Windows开发环境
vscode·编辑器
wmd1316430671213 小时前
IDEA插件CamelCase,快速转变命名格式
java·ide·intellij-idea
Gipsyz17 小时前
记录两次Unity编辑器和真机表现不符的情况,引用丢失等
编辑器
蓝黑20201 天前
IntelliJ IDEA常用快捷键
java·ide·intellij-idea