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

相關文章
相關標籤/搜索