Visual Studio中自定义代码段!

Visual Studio中自定义代码段!

第一步:在编辑器中进行快捷键的输入【ctrl + shift + p】 或者 点击 查看 第一个选项就是!请看下图

第二步:选择你要配置代码段的语言, 这里我会以Vue为例!

点击vue.json(vue)以后 能够看到以下东西!我已经配置好了!其实他也经有提示你怎么样去配置了!

这是个人配置文件!vue

{
	// Place your snippets for vue here. Each snippet is defined under a snippet name and has a prefix, body and 
	// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
	// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the 
	// same ids are connected.
	// Example:
	// 属性名:代码片断提示消息
	// 属性值:配置对象
	// "Print to console": {
		// prefix 出发代码片断的前缀!
	// 	"prefix": "log",
	// 代码片断!
	// 一个数组, 每一个元素占一行!
	// $1就是光标的第一个位置!以此类推!
	// ${2:thisisselfdata}能够自定义提示信息!
	// 	"body": [
	// 		"console.log('$1');",
	// 		"$2"
	// 	],
	// 	"description": "Log output to console"
	// }
	"Print Vue template": {
		"prefix": "vue",
		"body": [
			"<template>",
			"<div class=\"$1\">",
			"</div>",
			"</template>",
			"<script>",
			"export default {",
			" name: '',",
			" props: {},",
			" components: {},",
			" data () {",
			" return {}",
			" },",
			" computed: {},",
			" watch: {},",
			" methods: {},",
			" created () {},",
			" mounted () {},",
			" beforeDestroy () {}",
			"}",
			"</script>",
			"<style lang='less' scoped>",
			"</style>"
		],
		"description": "Log output to console"
	}
}

博客园是面向开发者的知识分享社区,不容许发布任何推广、广告、政治方面的内容。
博客园首页(即网站首页)只能发布原创的、高质量的、能让读者从中学到东西的内容。
若是博文质量不符合首页要求,会被工做人员移出首页,望理解。json

相关文章
相关标签/搜索