vs code创建vue模板

一字字敲vue模板是非常低效得事情,所以我搜索了如何在vs中创建vue模板方法,过程很简单。

  1. 使用Ctrl + Shift + P召唤出控制台,然后输入snippets并选择。
  2. 接着输入vue,vs code自动生成vue.json文件。
  3. 将文件改为下面得模板(请根据个人需求修改当中的内容)
{
	// Example:
	"Print to console": {
		"prefix": "vue",
		"body": [
			"<template>",
			"  <div class=\"wrapper\">$0</div>",
			"</template>",
			"",
			"<script>",
			"export default {",
			"  components: {},",
			"  props: {},",
			"  data() {",
			"    return {",
			"    };",
			"  },",
			"  watch: {},",
			"  computed: {},",
			"  methods: {},",
			"  created() {},",
			"  mounted() {}",
			"};",
			"</script>",
			"<style lang=\"scss\" scoped>",
			".wrapper{}",
			"</style>"    
		],
		"description": "A vue file template"
	}
}

更新:修改了格式,使其符合eslint标准
最后在你的vue文件中输入vue就可以生成模板,是不是很神奇?

猜你喜欢

转载自blog.csdn.net/tcap99/article/details/82746247