随笔 之 vscode快速生成vue模板

 1.点开左下角设置,选择用户代码片段

2.输入vue,选择vue.json

3.复制以下代码粘贴保存即可,

{
	"Print to console": {
		"prefix": "vue",    //输入vue,自动弹出提示,点击回车,即可生成模板
		"body": [
			"<template>",
			"  <div class='$TM_FILENAME_BASE-layout'>",
			"    $TM_FILENAME_BASE",
			"  </div>",
			"</template>",
			"",
			"<script>",
			"  export default {",
			"    name:'$TM_FILENAME_BASE',",
			"    props:{},",
			"    components: {},",
			"    data () {",
			"      return {",
			"      };",
			"    },",
			"    methods: {",
			"    /**",
			"    * 监听方法",
			"    */",
			"    /**",
			"    * 请求数据",
			"    */",
			"    },",
			"    mounted() {},",
			"    computed: {},",
			"    watch: {},",
			"    filters: {},",
			"  }",
			"",
			"</script>",
			"<style lang='less' scoped>",
			"//.$TM_FILENAME_BASE-layout{}",
			"</style>"
		],
		"description": "Log output to console"
	}
}

猜你喜欢

转载自blog.csdn.net/a15297701931/article/details/116295660