{
// Place your 全局 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"log快捷键": {
"scope": "",
"prefix": "log",
"body": [
"console.log('start======================');",
"console.log('$1');",
"console.log('end========================');",
],
"description": "log快捷键"
},
"const func快捷键": {
"scope": "",
"prefix": "func",
"body": [
"const ${1:func} = (${2:params}) => {\n\t$3\n}"
],
"description": "const func快捷键"
},
"useEffect 快捷键": {
"scope": "",
"prefix": "effect",
"body": [
"useEffect(() => {\n\t$2\n}, [$1])",
],
"description": "快速创建 useEffect"
},
"useState 快捷键": {
"scope": "",
"prefix": "state",
"body": [
"const [$2, set$3] = useState($1)",
],
"description": "快速创建 useState"
},
"匿名方法 快捷键": {
"scope": "",
"prefix": "func",
"body": [
"() => {\n\t$1\n}",
],
"description": "快速创建 useState"
},
"字体属性 快捷键": {
"scope": "",
"prefix": "font",
"body": [
"fontWeight: '400',",
"fontSize: sp(13),",
"lineHeight: sp(17),",
"color: Color.black",
],
"description": "快速创建 font属性"
},
"字高属性 快捷键": {
"scope": "",
"prefix": "line",
"body": [
"lineHeight: sp(17),",
],
"description": "快速创建 lineHeight属性"
},
"style 快捷键": {
"scope": "",
"prefix": "st",
"body": [
"style={styles.$1}",
],
"description": "快速创建 font属性"
},
"style属性 快捷键": {
"scope": "",
"prefix": "sts",
"body": [
"${1:name}: {",
"\t$2",
"},",
],
"description": "快速创建 font属性"
},
"height属性 快捷键": {
"scope": "",
"prefix": "he",
"body": [
"height: dpw($1),\n",
],
"description": "快速创建 height属性"
},
"width属性 快捷键": {
"scope": "",
"prefix": "wi",
"body": [
"width: dpw($1),\n",
],
"description": "快速创建 width属性"
},
"backgroundColor属性 快捷键": {
"scope": "",
"prefix": "bg",
"body": [
"backgroundColor: '${1:gray}',\n",
],
"description": "快速创建 backgroundColor属性"
},
"borderRadius 快捷键": {
"scope": "",
"prefix": "br",
"body": [
"borderRadius: dpw(${1:12}),\n",
],
"description": "快速创建 borderRadius属性"
},
"paddingHorizontal 快捷键": {
"scope": "",
"prefix": "ph",
"body": [
"paddingHorizontal: dpw(${1:12}),\n",
],
"description": "快速创建 paddingHorizontal属性"
},
"fontSize 快捷键": {
"scope": "",
"prefix": "fs",
"body": [
"fontSize: sp(${1:12}),\n",
],
"description": "快速创建 fontSize属性"
},
"justifyContent 快捷键": {
"scope": "",
"prefix": "just",
"body": [
"justifyContent: '${1:center}',\n",
],
"description": "快速创建 justifyContent属性"
},
"textAlign 快捷键": {
"scope": "",
"prefix": "textAlign",
"body": [
"textAlign: 'center',\n",
],
"description": "快速创建 textAlign"
},
"alignItems 快捷键": {
"scope": "",
"prefix": "align",
"body": [
"alignItems: '${1:center}',\n",
],
"description": "快速创建 alignItems属性"
},
"marginTop 快捷键": {
"scope": "",
"prefix": "mt",
"body": [
"marginTop: dpw(${1:12}),\n",
],
"description": "快速创建 marginTop属性"
},
"marginVertical 快捷键": {
"scope": "",
"prefix": "mv",
"body": [
"marginVertical:dpw(${1:12}),\n",
],
"description": "快速创建 marginVertical属性"
},
"absolute 快捷键": {
"scope": "",
"prefix": "ab",
"body": [
"position:'${1:absolute'},\n",
],
"description": "快速创建 absolute属性"
},
"require 快捷键": {
"scope": "",
"prefix": "so",
"body": [
"source={require('@assets/images/home/${1:name}.png')}",
],
"description": "快速创建 require属性"
},
"right 快捷键": {
"scope": "",
"prefix": "ri",
"body": [
"right: dpw(${1:10}),\n",
],
"description": "快速创建 right属性"
},
"left 快捷键": {
"scope": "",
"prefix": "le",
"body": [
"left: dpw(${1:10}),\n",
],
"description": "快速创建 left属性"
},
"top 快捷键": {
"scope": "",
"prefix": "to",
"body": [
"top: dpw(${1:10}),\n",
],
"description": "快速创建 top属性"
},
"bottom 快捷键": {
"scope": "",
"prefix": "bo",
"body": [
"bottom: dpw(${1:10}),\n",
],
"description": "快速创建 bottom属性"
},
"marginBottom 快捷键": {
"scope": "",
"prefix": "mb",
"body": [
"marginBottom: dpw(${1:10}),\n",
],
"description": "快速创建 marginBottom属性"
},
"marginHorizontal 快捷键": {
"scope": "",
"prefix": "mh",
"body": [
"marginHorizontal: dpw(${1:10}),\n",
],
"description": "快速创建 marginHorizontal属性"
},
"flexRow 快捷键": {
"scope": "",
"prefix": "flexrow",
"body": [
"flexDirection: 'row',\n",
],
"description": "快速创建 flexRow 属性"
},
"flexColumn 快捷键": {
"scope": "",
"prefix": "flexcolumn",
"body": [
"flexDirection: 'column',\n",
],
"description": "快速创建 flexColumn 属性"
},
"borderWidth 快捷键": {
"scope": "",
"prefix": "bw",
"body": [
"borderWidth:dpw(${1:1}),\n",
],
"description": "快速创建 borderWidth 属性"
},
"borderColor 快捷键": {
"scope": "",
"prefix": "bc",
"body": [
"borderColor:'${1:rgba(0, 0, 0, 1)}',\n",
],
"description": "快速创建 borderColor 属性"
},
"marginRight 快捷键": {
"scope": "",
"prefix": "mr",
"body": [
"marginRight:dpw(${1:10}),\n",
],
"description": "快速创建 marginRight 属性"
},
"marginLeft 快捷键": {
"scope": "",
"prefix": "ml",
"body": [
"marginLeft:dpw(${1:10}),\n",
],
"description": "快速创建 marginLeft 属性"
},
"device 快捷键": {
"scope": "",
"prefix": "de",
"body": [
"useEffect(() => {",
"const remove = DeviceEventEmitter.addListener(notificationKey.${1:go_to_music_detail}, (${2:songImage})=>{\n",
"})",
"return ()=>{",
"remove.remove()",
"}",
"}, [])",
],
"description": "快速创建 device 属性"
},
"eventEmitter 监听事件快捷键": {
"scope": "",
"prefix": "emit",
"body": [
"useEffect(() => {",
"const listener = () => {",
"${0}",
"};",
"eventEmitter.on(notificationKey.${1:refresh_weight_chart}, listener);",
"return () => {",
"eventEmitter.removeListener(",
"notificationKey.${1:refresh_weight_chart},",
"listener,",
");",
"};",
"}, [])",
],
"description": "快速创建 emiter 属性"
},
"effectReturn 快捷键": {
"scope": "",
"prefix": "effectReturn",
"body": [
"useEffect(() => {",
"return () => {",
"${1:DeviceEventEmitter.emit(notificationKey.float_music_panel, true);}",
"};",
"}, []);",
],
"description": "快速创建 effectReturn 属性"
},
"navigationType 快捷键": {
"scope": "",
"prefix": "navigationType",
"body": [
"export type ${1:RecordVoice}RouteParams = {",
"${2:defaultCount}: ${3:number};",
"};",
],
"description": "快速创建 navigationType 属性"
},
"StyleSheet 快捷键": {
"scope": "",
"prefix": "styleshe",
"body": [
"const styles = StyleSheet.create({",
"$1\n",
"})",
],
"description": "StyleSheet 属性"
},
"navigation 快捷键": {
"scope": "",
"prefix": "navi",
"body": [
"const navigation = useNavigation<any>()",
],
"description": "快速获取navigation"
},
"inset 快捷键": {
"scope": "",
"prefix": "inset",
"body": [
" const inset = useSafeAreaInsets()",
],
"description": "快速获取inset"
},
"useSelector 快捷键": {
"scope": "",
"prefix": "selector",
"body": [
"const {${1:user}} = useAppSelector((state: RootState)=> ({ ...state.${2:user} }),shallowEqual,);",
],
"description": "快速获取useSelector"
},
"useDispatch 快捷键": {
"scope": "",
"prefix": "dispatch",
"body": [
"const dispatch = useAppDispatch()",
],
"description": "快速获取useDispatch"
},
"dispatch 快捷键": {
"scope": "",
"prefix": "dispatchSet",
"body": [
"const data = ${1:value};",
"dispatch(setCache(data));",
],
"description": "快速set dispatch"
},
"emit 快捷键": {
"scope": "",
"prefix": "emit",
"body": [
"DeviceEventEmitter.emit(notificationKey.${1:have_update})",
],
"description": "快速创建emit"
},
"eventEmitter 发送事件快捷键": {
"scope": "",
"prefix": "emit",
"body": [
"eventEmitter.emit(notificationKey.${1:have_update})",
],
"description": "快速创建emit"
},
"await 快捷键": {
"scope": "",
"prefix": "await",
"body": [
"try {",
"const res = await ${1:referAPI.getCredits();}",
"\n",
"}catch (error) {",
"\n",
"}",
],
"description": "快速创建await"
},
"color 快捷键": {
"scope": "",
"prefix": "co",
"body": [
"color:'${1:rgba(0, 0, 0, 1)}',\n",
],
"description": "快速创建 color"
},
"paddingVertical 快捷键": {
"scope": "",
"prefix": "pv",
"body": [
"paddingVertical:dpw(${1:12}),\n",
],
"description": "快速创建 paddingVertical"
},
"paddingTop 快捷键": {
"scope": "",
"prefix": "pt",
"body": [
"paddingTop:dpw(${1:12}),\n",
],
"description": "快速创建 paddingTop"
},
"paddingLeft 快捷键": {
"scope": "",
"prefix": "pl",
"body": [
"paddingLeft:dpw(${1:12}),\n",
],
"description": "快速创建 paddingLeft"
},
"paddingRight 快捷键": {
"scope": "",
"prefix": "pr",
"body": [
"paddingRight:dpw(${1:12}),\n",
],
"description": "快速创建 paddingRight"
},
"paddingBottom 快捷键": {
"scope": "",
"prefix": "pb",
"body": [
"paddingBottom:dpw(${1:12}),\n",
],
"description": "快速创建 paddingBottom"
},
"hitSlop 快捷键": {
"scope": "",
"prefix": "hit",
"body": [
"hitSlop={{top: 10, bottom: 10, left: 10, right: 10}}\n",
],
"description": "快速创建 hitSlop"
},
"IProps 快捷键": {
"scope": "",
"prefix": "iprops",
"body": [
"interface IProps {",
"${1}",
"}\n",
],
"description": "快速创建 IProps"
},
"focus 快捷键": {
"scope": "",
"prefix": "focus",
"body": [
"// 进入页面",
"const unsubscribe = navigation.addListener('focus', () => {${1}});",
"return unsubscribe;",
],
"description": "focus 快捷键"
},
"white 快捷键": {
"scope": "",
"prefix": "white",
"body": [
"'rgba(255, 255, 255, ${1:1})'",
],
"description": "white 快捷键"
},
"black 快捷键": {
"scope": "",
"prefix": "black",
"body": [
"'rgba(0, 0, 0, ${1:1})'",
],
"description": "black 快捷键"
},
"export 快捷键": {
"scope": "",
"prefix": "export",
"body": [
"const ${1:GestureRootView} = () => {",
"return <View></View>;",
"};",
"export default ${1:GestureRootView}",
],
"description": "export 快捷键"
},
"export use 快捷键": {
"scope": "",
"prefix": "export use",
"body": [
"const ${1:GestureRootView} = () => {",
"${2}",
"};",
"export default ${1:GestureRootView}",
],
"description": "export use 快捷键"
},
"goBack 快捷键": {
"scope": "",
"prefix": "goBack",
"body": [
"navigation.canGoBack() && navigation.goBack();",
],
"description": "goBack 快捷键"
},
"popup 快捷键": {
"scope": "",
"prefix": "popup",
"body": [
"logEventBySensors('EntryPopUp', {",
"e_popup_page: ${1:pageName},",
"})",
],
"description": "popup 快捷键"
},
"popupClick 快捷键": {
"scope": "",
"prefix": "popupclick",
"body": [
"logEventBySensors('ClickPopUpButton', {",
"e_popup_page: ${1:pageName},",
"e_operation_click: ${2:clickName}",
"})",
],
"description": "popupClick 快捷键"
},
"isZh 快捷键": {
"scope": "",
"prefix": "isZh",
"body": [
"const { i18n } = useTranslation();",
"const isZh = i18n.language === 'zh';",
],
"description": "isZh 快捷键"
},
"isEn 快捷键": {
"scope": "",
"prefix": "isEn",
"body": [
"const isEn = i18n.language === 'en';",
],
"description": "isEn 快捷键"
},
"shadow 快捷键": {
"scope": "",
"prefix": "shadow",
"body": [
"shadowColor: 'rgba(0, 0, 0, 0.3)',",
"shadowOffset: {",
"width: 1,",
"height: dpw(2),",
"},",
"shadowRadius: dpw(3),",
"shadowOpacity: 0.3,",
"backgroundColor: 'white',",
"borderRadius: dpw(20),",
],
"description": "shadow 快捷键"
},
}
代码块
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
相关阅读更多精彩内容
- 先父类后子类 从上面代码可得:父类静态代码块>main函数(处于父类)>子类静态代码块>main函数(处于子类)>...
- 普通代码块:在方法或语句中出现的{}就称为普通代码块。普通代码块和一般的语句执行顺序由他们在代码中出现的次序决定-...
- 1、概念 普通代码块:在方法或语句中出现的{}就称为普通代码块。普通代码块和一般的语句执行顺序由他们在代码中出现的...
- 一、静态代码块 在java类中(方法中不能存在静态代码块)使用static关键字和{}声明的代码块: 执行时机静态...
- 执行结果为:static,55,20,show,55,20 分析 :1、先执行StaticCode这个类,所以st...