当前位置:网站首页>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创建自己的代码模板
边栏推荐
- Leetcode-31: next spread
- Leetcode-9: palindromes
- MySQL advanced part 1: triggers
- 容斥原理 AcWing 890. 能被整除的数
- Alibaba established the enterprise digital intelligence service company "Lingyang" to focus on enterprise digital growth
- Single chip computer engineering experience - layered idea
- [2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis
- [leetcode] day95 effective Sudoku & matrix zeroing
- Winter vacation water test 1 Summary
- Gaussian elimination acwing 884 Gauss elimination for solving XOR linear equations
猜你喜欢
Sqlmap tutorial (II) practical skills I
3.Oracle-控制文件的管理
Find the combination number acwing 888 Find the combination number IV
1.14 - assembly line
高斯消元 AcWing 884. 高斯消元解异或線性方程組
1.15 - input and output system
5. Oracle tablespace
Alibaba established the enterprise digital intelligence service company "Lingyang" to focus on enterprise digital growth
Bit of MySQL_ OR、BIT_ Count function
1.手动创建Oracle数据库
随机推荐
在新线程中使用Handler
Golang uses context gracefully
Operator priority, one catch, no doubt
Bit of MySQL_ OR、BIT_ Count function
Shutter web hardware keyboard monitoring
Basic explanation of typescript
Presentation of attribute value of an item
Network security skills competition in Secondary Vocational Schools -- a tutorial article on middleware penetration testing in Guangxi regional competition
博弈论 AcWing 893. 集合-Nim游戏
Game theory acwing 893 Set Nim game
Leetcode backtracking method
1.14 - assembly line
Doing SQL performance optimization is really eye-catching
How to set the drop-down arrow in the spinner- How to set dropdown arrow in spinner?
MySQL advanced part 2: storage engine
MPLS experiment
How to generate an image from text on fly at runtime
Record the process of configuring nccl and horovod in these two days (original)
SPI details
Redis-01.初识Redis