vscode代码块

2024-06-04  本文已影响0人  太平洋_cfd2
  1. https://juejin.cn/post/6844903869424599053
{
    // 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: pxToVw(13),",
            "color: 'rgba(235, 235, 245, 0.6)',"
        ],
        "description": "快速创建 font属性"
},
"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: pxToVh($1),\n",
        ],
        "description": "快速创建 height属性"
},
"width属性 快捷键": {
        "scope": "",
        "prefix": "wi",
        "body": [
                "width: pxToVw($1),\n",
        ],
        "description": "快速创建 width属性"
},
"backgroundColor属性 快捷键": {
        "scope": "",
        "prefix": "bg",
        "body": [
                "backgroundColor: '${1:gray}',\n",
        ],
        "description": "快速创建 backgroundColor属性"
},
"borderRadius 快捷键": {
        "scope": "",
        "prefix": "br",
        "body": [
                "borderRadius: pxToVw(${1:12}),\n",
        ],
        "description": "快速创建 borderRadius属性"
},
"paddingHorizontal 快捷键": {
        "scope": "",
        "prefix": "ph",
        "body": [
                "paddingHorizontal: pxToVw(${1:12}),\n",
        ],
        "description": "快速创建 paddingHorizontal属性"
},
"fontSize 快捷键": {
        "scope": "",
        "prefix": "fs",
        "body": [
                "fontSize: pxToVw(${1:12}),\n",
        ],
        "description": "快速创建 fontSize属性"
},
"justifyContent 快捷键": {
        "scope": "",
        "prefix": "jc",
        "body": [
                "justifyContent: '${1:center}',\n",
        ],
        "description": "快速创建 justifyContent属性"
},
"alignItems 快捷键": {
        "scope": "",
        "prefix": "ai",
        "body": [
                "alignItems: '${1:center}',\n",
        ],
        "description": "快速创建 alignItems属性"
},
"marginTop 快捷键": {
        "scope": "",
        "prefix": "mt",
        "body": [
                "marginTop: pxToVh(${1:12}),\n",
        ],
        "description": "快速创建 marginTop属性"
},
"marginVertical 快捷键": {
        "scope": "",
        "prefix": "mv",
        "body": [
                "marginVertical:pxToVh(${1:12}),\n",
        ],
        "description": "快速创建 marginVertical属性"
},
"absolute 快捷键": {
        "scope": "",
        "prefix": "ab",
        "body": [
                "position:'${1:absolute'},\n",
        ],
        "description": "快速创建 absolute属性"
},
"require 快捷键": {
        "scope": "",
        "prefix": "so",
        "body": [
                "source={require('@asset/images/${1:name}.png')}",
        ],
        "description": "快速创建 require属性"
},
"right 快捷键": {
        "scope": "",
        "prefix": "ri",
        "body": [
                "right: pxToVw(${1:10}),\n",
        ],
        "description": "快速创建 right属性"
},
"left 快捷键": {
        "scope": "",
        "prefix": "le",
        "body": [
                "left: pxToVw(${1:10}),\n",
        ],
        "description": "快速创建 left属性"
},
"top 快捷键": {
        "scope": "",
        "prefix": "to",
        "body": [
                "top: pxToVw(${1:10}),\n",
        ],
        "description": "快速创建 top属性"
},
"bottom 快捷键": {
        "scope": "",
        "prefix": "bo",
        "body": [
                "bottom: pxToVh(${1:10}),\n",
        ],
        "description": "快速创建 bottom属性"
},
"marginBottom 快捷键": {
        "scope": "",
        "prefix": "mb",
        "body": [
                "marginBottom: pxToVh(${1:10}),\n",
        ],
        "description": "快速创建 marginBottom属性"
},
"marginHorizontal 快捷键": {
        "scope": "",
        "prefix": "mh",
        "body": [
                "marginHorizontal: pxToVw(${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:pxToVw(${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:pxToVw(${1:10}),\n",
        ],
        "description": "快速创建 marginRight 属性"
},
"marginLeft 快捷键": {
        "scope": "",
        "prefix": "ml",
        "body": [
                "marginLeft:pxToVw(${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 属性"
},
"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()",
        ],
        "description": "快速获取navigation"
},
"inset 快捷键": {
        "scope": "",
        "prefix": "inset",
        "body": [
            "  const inset = useSafeAreaInsets()",
        ],
        "description": "快速获取inset"
},
"useSelector 快捷键": {
        "scope": "",
        "prefix": "selector",
        "body": [
            "const ${1:songDescription} = useSelector((state: RootState)=> state.${2:cache.data.songDescription)}",
        ],
        "description": "快速获取useSelector"
},
"useDispatch 快捷键": {
        "scope": "",
        "prefix": "dispatch",
        "body": [
            "const dispatch = useDispatch()",
        ],
        "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"
},
"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:pxToVh(${1:12}),\n",
        ],
        "description": "快速创建 paddingVertical"
},
"paddingTop 快捷键": {
        "scope": "",
        "prefix": "pt",
        "body": [
            "paddingTop:pxToVh(${1:12}),\n",
        ],
        "description": "快速创建 paddingTop"
},
"paddingLeft 快捷键": {
        "scope": "",
        "prefix": "pl",
        "body": [
            "paddingLeft:pxToVw(${1:12}),\n",
        ],
        "description": "快速创建 paddingLeft"
},
"paddingRight 快捷键": {
        "scope": "",
        "prefix": "pr",
        "body": [
            "paddingRight:pxToVw(${1:12}),\n",
        ],
        "description": "快速创建 paddingRight"
},
"paddingBottom 快捷键": {
        "scope": "",
        "prefix": "pb",
        "body": [
            "paddingBottom:pxToVh(${1:12}),\n",
        ],
        "description": "快速创建 paddingBottom"
},

}
上一篇 下一篇

猜你喜欢

热点阅读