当前位置:网站首页>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创建自己的代码模板
边栏推荐
- ollvm编译出现的问题纪录
- 4. Oracle redo log file management
- June 29, 2022 daily
- Leetcode dynamic programming
- FFmpeg build下载(包含old version)
- Operator priority, one catch, no doubt
- Basic explanation of typescript
- Redis-01.初识Redis
- [2021]IBRNet: Learning Multi-View Image-Based Rendering Qianqian
- What's wrong with this paragraph that doesn't work? (unresolved)
猜你喜欢
Interval problem acwing 906 Interval grouping
MySQL advanced part 2: optimizing SQL steps
Gaussian elimination acwing 884 Gauss elimination for solving XOR linear equations
WordPress switches the page, and the domain name changes back to the IP address
Client use of Argo CD installation
Suppose a bank's ATM machine, which allows users to deposit and withdraw money. Now there is 200 yuan in an account, and both user a and user B have the right to deposit and withdraw money from this a
TCP's understanding of three handshakes and four waves
4. 对象映射 - Mapping.Mapster
高斯消元 AcWing 884. 高斯消元解异或线性方程组
Game theory acwing 893 Set Nim game
随机推荐
Niu Mei's math problems
__ builtin_ Popcount() counts the number of 1s, which are commonly used in bit operations
Modnet matting model reproduction
时间很快,请多做有意义的事情
Basic explanation of typescript
求组合数 AcWing 889. 满足条件的01序列
MySQL advanced part 2: MySQL architecture
MySQL advanced part 2: SQL optimization
Leetcode-6108: decrypt messages
Chart. JS - Format Y axis - chart js - Formatting Y axis
2022-5-第四周日报
Find the combination number acwing 887 Find combination number III
Game theory acwing 892 Steps Nim game
In depth analysis of for (VaR I = 0; I < 5; i++) {settimeout (() => console.log (I), 1000)}
11-gorm-v2-02-create data
2021apmcm post game Summary - edge detection
Day 2 document
C Primer Plus Chapter 15 (bit operation)
MySQL advanced part 1: triggers
容斥原理 AcWing 890. 能被整除的数