VSCode配置Vue代码片段

2021/10/13 VueVSCode

# 1. 在VSCode中打开用户片段配置

菜单: 文件=>首选项=>用户片段=>输入片段名称(vue)

# 2. 追加片段内容

"Print to console": {
		"prefix": "vue",
		"body": [
			"<template>",
			"  <div>$0</div>",
			"</template>",
			"",
			"<script>",
			"export default {",
			"  name:'',",
			"  components:{},",
			"  props:{},",
			"  data(){",
			"    return {",
			"    }",
			"  },",
			"  watch:{},",
			"  computed:{},",
			"  methods:{},",
			"  created(){},",
			"  mounted(){}",
			"}",
			"</script>",
			"<style scoped lang='less'>",
			"",
			"</style>"
		],
		"description": "A vue file template"
	}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

# 3. 在.vue文件中使用代码片段

输入片段名称 vue 然后按tab键。

Last Updated: 2022/4/2 11:25:31