网络编程 发布日期:2025/10/31 浏览次数:1
如何自定义自己的开发模板?你需要这几步:
下面是我的模板代码:
{
	"Print to console": {
	 "prefix": "vue",
	 "body": [
		"<!-- $0 -->",
		"<template>",
		" <div></div>",
		"</template>",
		"",
		"<script>",
		"export default {",
		" data () {",
		"  return {",
		"  }",
		" },",
		"",
		" //方法集合",
		" methods: {",
		"",
		" },",
		"",
		" //生命周期 - 创建完成(可以访问当前this实例)",
		" created(){",
		"",
		" },",
		"",
		" //生命周期 - 挂载完成(可以访问DOM元素)",
		" mounted(){",
		"",
		" },",
		" //生命周期 - 创建之前",
		" beforeCreate(){",
		"",
		" },",
		" //生命周期 - 挂载之前",
		" beforeMount(){",
		"",
		" },",
		" //生命周期 - 更新之前",
		" beforeUpdate(){",
		"",
		" },",
		" //生命周期 - 更新之后",
		" updated(){",
		"",
		" },",
		" //生命周期 - 销毁之前",
		" beforeDestroy(){",
		"",
		" },",
		" //生命周期 - 销毁完成",
		" destroyed(){",
		"",
		" },",
		" //如果页面有keep-alive缓存功能,该函数会触发",
		" activated(){",
		"",
		" }",
		"}",
		"",
		"</script>",
		"<style lang='scss' scoped>",
		"</style>"
	],
	 "description": "Log output to console"
	}
 }
效果如下: