vscode设置代码片段 vue代码模板

vscode设置代码片段 vue代码模板

  • 文件 -> 首选项 -> 用户片段

  • 选择新代码片段

  • 在文件底下添加自己的代码模板
"Create vue template": {
		"prefix": "vue3router",
		"body": [
			"import { createRouter, createWebHashHistory } from 'vue-router';",
			"",
			"const router = createRouter({",
			"    history: createWebHashHistory(),",
			"    routes: [",
			"        { path: '/', component: () => import('../views/home.vue')}",
			"    ]",
			"})",
			"",
			"export default router"
		],
		"description": "Create vue3router template"
	}

  • 解释
  1. prefix:输入xxx,就可以提示出这段代码模板

  1. body:代码内容,每一行都要用双引号括起来,注意结尾要在外面加逗号,空行也要用双引号

  2. description:代码提示时候显示的描述

posted @ 2021-07-23 17:42  -西门-  阅读(206)  评论(0编辑  收藏  举报