(1)点击 vscode 左下角的齿轮设置按钮,点击用户代码片段
在这里插入图片描述
(2)输入 vue,选择 vue.json 文件

在这里插入图片描述
(3)在注释下添加如下代码即可

{
	"Print to console": {
		"prefix": "vue3",        //键入该值,按tab快捷产生
		"body": [
			"<template>",
			"",
			"</template>",
			"<script setup>",
			"",
			"</script>",
			"<style scoped lang='scss'>",
			"</style>",
			"$2"
		],
		"description": "Log output to console"
	}
}

保存即可。
使用时输入 vue3 即可快速生成 vue3 模板。
在这里插入图片描述
补充一下 vue 的模板

{
	"Print to console": {
		"prefix": "vue2",        //键入该值,按tab快捷产生
		"body": [
			"<template>",
			"  <div></div>",
			"</template>",
			"",
			"<script>",
			"export default {",
			"  components: {},",
			"",
			"  data() {",
            "     return {",
            "",
            "     };",
            "   },",
			"",
			"  mounted() {",
            "",
            "  },",
			"",
			"  methods: {",
            "",
            "  }",

			"}",
			"</script>",
			"",
			"<style scoped lang='scss'>",
			"</style>",
			"$2"
		],
		"description": "A vue2 file template"
	}
}
Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐