vue开发中如何使用自定义代码片段

vue开发中如何使用自定义代码片段

在这里插入图片描述
左下角设置点击代码片段,输入vue搜索打开vue.json文件

我这里使用了 vue2和vue3的代码片段,使用快捷键直接输入vue模板

 
{
	"Print to console": {
	  "prefix": "vue3",
	  "body": [
		"<template>",
		"  <div class=\"\"></div>",
		"</template>\n",
		"<script setup lang='ts' name=''>",
		"</script>\n",
		"<style scoped></style>",
		"$2"
	  ],
	},
	"Print Hello Vue": {
        "prefix": "vue",
        "body": [
            "<template>",
            "  <div>",
            "    Hello, Vue 2!",
            "  </div>",
            "</template>",
            "",
            "<script>",
            "export default {",
            "  name: 'HelloVue',",
            "  data() {",
            "    return {};",
            "  },",
            "};",
            "</script>",
            "",
            "<style scoped>",
            "/* Your styles here */",
            "</style>"
        ],
        "description": "Create a simple Vue component that prints 'Hello, Vue 2!'"
    },
    "Vue Component": {
        "prefix": "vcomp",
        "body": [
            "<template>",
            "  <div class=\"$1\">",
            "    $0",
            "  </div>",
            "</template>",
            "",
            "<script>",
            "export default {",
            "  name: '$2',",
            "  props: {",
            "    // define your props here",
            "  },",
            "  data() {",
            "    return {",
            "      // your data here",
            "    };",
            "  },",
            "  methods: {",
            "    // your methods here",
            "  },",
            "  computed: {",
            "    // your computed properties here",
            "  },",
            "  watch: {",
            "    // your watchers here",
            "  },",
            "  mounted() {",
            "    // your mounted lifecycle hook here",
            "  }",
            "};",
            "</script>",
            "",
            "<style scoped>",
            "/* Your styles here */",
            "</style>"
        ],
        "description": "Create a basic Vue 2 component structure."
    }
  }
  

有需要的拿走不谢。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值