腾讯新闻前端团队通用代码片段code-snippets,可以通过简单的简写快速生成代码片段,从而提升编码效率。
js代码简写
简写 |
代码片段 |
qcs |
console |
qi |
if |
qf |
for |
qd |
div |
qfc |
function |
qst |
setTimeout |
qfe |
forEach |
qfi |
for in |
qfo |
for of |
qip |
import |
qco |
const |
ql |
let |
qcst |
constant |
qe |
enum |
qif |
interface |
qt |
type |
qus |
useState |
que |
useEffect |
qss |
setState |
qrh |
函数组件模板代码 |
css代码简写
简写 |
代码片段 |
qcl |
class选择器 |
qid |
id选择器 |
qbd |
border |
js简写与代码的映射
qcs - console
console.log('1', 1);
qi - if
if () {
}
qf - for
for (let i = 0; i < .length; i++) {
}
qd - div
<div className={Styles.}></div>
qfc - function
const = async () => {
};
qst - setTimeout
setTimeout(() => {
}, 300);
qfe - forEach
array.forEach((e) => {
});
qfi - for in
for (const elem in obj) {
}
qfo - for of
for (const elem of obj) {
}
qip - import
import { } from '';
qco - const
const a = ;
ql - let
let a = ;
qcst - constant
const DATA_Level = {
levelOne: 1,
levelTwo: 2,
};
qe - enum
enum DataLevel {
levelOne = 1,
levelTwo = 2,
}
qif - interface
interface InterfaceData {
paramOne: string;
paramTwo: number;
paramThree: boolean;
}
qt - type
type TypeData = {
paramOne: string;
paramTwo: number;
paramThree: boolean;
}
qus - useState
const [a, setA] = useState('');
que - useEffect
useEffect(() => {
}, []);
qss - setState
this.setState({ params: 1 });
qrh - 函数组件模板代码
import React, { useEffect, useState } from 'react';
function MyComponent() {
const [a, setA] = useState('');
useEffect(() => {
}, []);
return (
<div></div>
);
}
export default MyComponent;
css简写与代码的映射
qcl - class选择器
. {
}
qid - id选择器
# {
}
qbd - border
border: 1px solid red;
咨询
ruikunai(第一名的小蝌蚪)