当前位置:网站首页>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创建自己的代码模板
边栏推荐
- JS quickly converts JSON data into URL parameters
- Open source storage is so popular, why do we insist on self-development?
- What's wrong with this paragraph that doesn't work? (unresolved)
- P3265 [jloi2015] equipment purchase
- 栈 AcWing 3302. 表达式求值
- WordPress switches the page, and the domain name changes back to the IP address
- MySQL advanced part 1: View
- LeetCode 0107. Sequence traversal of binary tree II - another method
- 3. Oracle control file management
- 5.Oracle-表空间
猜你喜欢

1.手动创建Oracle数据库

什么是套接字?Socket基本介绍
![[2021]GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields](/img/65/7fa32cd0005ddaaebacd85c25e0c7e.jpg)
[2021]GIRAFFE: Representing Scenes as Compositional Generative Neural Feature Fields

高斯消元 AcWing 884. 高斯消元解异或線性方程組

Inclusion exclusion principle acwing 890 Divisible number

阿里巴巴成立企业数智服务公司“瓴羊”,聚焦企业数字化增长

5. Oracle tablespace

Operator priority, one catch, no doubt

Game theory acwing 892 Steps Nim game

Game theory acwing 891 Nim games
随机推荐
Game theory acwing 894 Split Nim game
Gauss Cancellation acwing 884. Solution d'un système d'équations Xor linéaires par élimination gaussienne
LeetCode 0107. Sequence traversal of binary tree II - another method
Liunx starts redis
时间很快,请多做有意义的事情
博弈论 AcWing 891. Nim游戏
5.Oracle-錶空間
【LeetCode】Day94-重塑矩阵
[leetcode] day95 effective Sudoku & matrix zeroing
[2020]GRAF: Generative Radiance Fields for 3D-Aware Image Synthesis
博弈论 AcWing 892. 台阶-Nim游戏
Presentation of attribute value of an item
P2575 master fight
求组合数 AcWing 888. 求组合数 IV
4.Oracle-重做日志文件管理
【LeetCode】Day95-有效的数独&矩阵置零
Redis publish subscribe command line implementation
7.Oracle-表结构
将webApp或者H5页面打包成App
Redis-01.初识Redis
