当前位置:网站首页>vsCode创建自己的代码模板
vsCode创建自己的代码模板
2022-07-05 06:23:00 【Heerey525】
情况
最近重温react,写jsx代码有点多,新建组件每次都要手打一遍或者copy一份模板,太不方便了,打算配一套模板,之后再次使用是就可以快捷键直接生成。
创建步骤
1.入口打开
入口一:(左上角)文件-首选项-用户代码片段
入口二:如下图
2.新建代码片段
为了不影响其他的代码片段,我们选择 新建全局代码片段文件
填写你要创建的文件名,我打算创建jsx的代码片段,所以取名jsx,然后点击保存
默认的是举得例子
3.编写配置
prefix:快捷键
body:配置的代码片段 \t指加空格缩进 \n指换行
description:代码片段的描述
这是代码,你也可以参照着,配置一套vue的模板
{
"jsx_template": {
"prefix": "jsx",
"body": [
"import React, { Component } from 'react';\n",
"export default class xx extends Component {",
"\trender() {",
"\t\treturn <div>xx</div>;",
"\t}",
"}"
],
"description": "jsx的模板"
}
}
4.使用
直接输入jsx,回车
参考资料:vsCode创建自己的代码模板
边栏推荐
猜你喜欢

容斥原理 AcWing 890. 能被整除的数

求组合数 AcWing 888. 求组合数 IV

2.Oracle-数据文件的添加及管理

3. Oracle control file management

2021apmcm post game Summary - edge detection

Game theory acwing 893 Set Nim game
![[moviepy] unable to find a solution for exe](/img/0a/4841f53cedc1333654b9443e406f4c.jpg)
[moviepy] unable to find a solution for exe

Redis publish subscribe command line implementation

1.13 - RISC/CISC

MySQL advanced part 1: index
随机推荐
Leetcode divide and conquer / dichotomy
背包问题 AcWing 9. 分组背包问题
区间问题 AcWing 906. 区间分组
Nested method, calculation attribute is not applicable, use methods
How to set the drop-down arrow in the spinner- How to set dropdown arrow in spinner?
Modnet matting model reproduction
1.14 - assembly line
MySQL advanced part 1: index
Bit of MySQL_ OR、BIT_ Count function
Leetcode-3: Longest substring without repeated characters
2022/6/29-日报
Client use of Argo CD installation
How to generate an image from text on fly at runtime
求组合数 AcWing 887. 求组合数 III
【LeetCode】Day94-重塑矩阵
Leetcode-22: bracket generation
Is it impossible for lamda to wake up?
Currently clicked button and current mouse coordinates in QT judgment interface
Leetcode backtracking method
Golang uses context gracefully
