在VScode中创建你的代码模板的方法
作者:乐活是一种态度 时间:2022-08-28 10:52:09
使用VScode的用户代码片段功能,来生成自己习惯的代码模板,提升开发效率
1.选择菜单里的 文件 > 首选项 > 用户代码片段
2.选择你需要自定义模板的文件,以vue为例
3. 配置对应文件json
把代码片段写在json里。每个代码段都是在一个代码片段名称下定义的,并且有prefix、body和description。prefix是用来触发代码片段的。使用 $1,$2 等指定光标位置,这些数字指定了光标跳转的顺序,$0表示最终光标位置。
{
"vue-template": {
"prefix": "vue",
"body": [
"<template>",
" <div class=\"$1\">",
"",
" </div>",
"</template>",
"",
"<script>",
"export default {",
" name: '$1',",
" data() { ",
" return {",
"",
" }",
" }",
" }",
"</script>",
"",
"<style lang=\"\" scoped>",
" .$1{",
"",
" }",
"</style>"
],
"description": "my vue template"
}
}
还有更复杂的用法…一般也用不到,我就不在这里写了。
来源:https://blog.csdn.net/weixin_38628686/article/details/80284892
标签:VScode,创建,模板
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
python np.arange 步长0.1的问题需要特别注意
2021-09-26 08:49:49
![](https://img.aspxhome.com/file/2023/4/118784_0s.png)
django如何根据现有数据库表生成model详解
2024-01-17 02:29:21
![](https://img.aspxhome.com/file/2023/3/91983_0s.png)
php对数字进行万、亿单位的转化
2023-06-24 08:34:32
GO语言延迟函数defer用法详解
2024-02-18 16:56:27
![](https://img.aspxhome.com/file/2023/8/105128_0s.png)
Bootstrap select多选下拉框实现代码
2023-09-15 12:44:55
![](https://img.aspxhome.com/file/2023/6/56316_0s.jpg)
django使用F方法更新一个对象多个对象字段的实现
2021-07-20 10:38:42
python数组如何添加整行或整列
2022-04-29 16:39:30
ASP脚本循环语句
2009-02-19 13:34:00
pydev使用wxpython找不到路径的解决方法
2023-02-23 05:01:01
python循环语句的使用方法
2023-06-21 10:20:38
![](https://img.aspxhome.com/file/2023/8/131198_0s.png)
解读MaxPooling1D和GlobalMaxPooling1D的区别
2023-07-21 10:54:43
![](https://img.aspxhome.com/file/2023/3/97243_0s.png)
Mysql删除数据以及数据表的方法实例
2024-01-22 19:53:04
Python类中self参数用法详解
2023-06-19 00:40:54
不到20行实现Python代码即可制作精美证件照
2021-08-29 09:27:43
![](https://img.aspxhome.com/file/2023/8/130568_0s.png)
python __init__与 __new__的区别
2022-05-04 01:27:57
Python获取脚本所在目录的正确方法
2022-12-07 14:37:36
Python数据类型--字典dictionary
2023-06-19 12:49:53
![](https://img.aspxhome.com/file/2023/6/94106_0s.png)
解决Oracle安装遇到Enterprise Manager配置失败问题
2024-01-21 03:48:28
![](https://img.aspxhome.com/file/2023/1/67541_0s.png)
SQL查询连续登陆7天以上的用户的方法实现
2024-01-18 10:16:44
![](https://img.aspxhome.com/file/2023/6/92796_0s.png)
Javascript中判断一个值是否为undefined的方法详解
2024-04-19 09:54:13