编辑器快捷键存档

{
    // Place your snippets for vue here. Each snippet is defined under a snippet name and has a prefix, body and 
    // description. 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:
    // "Print to console": {
    // 	"prefix": "log",
    // 	"body": [
    // 		"console.log('$1');",
    // 		"$2"
    // 	],
    // 	"description": "Log output to console"
    // }
    "定义一个箭头函数": {
        "prefix": "arrow",
        "body": [
            "const $1 = ($2) => {",
            "  $3",
            "};"
        ],
        "description": "箭头函数"
    },
    "export 导出": {
        "prefix": "exp",
        "body": [
            "export default $1;"
        ],
        "description": "导出模块"
    },
    "import 导入": {
        "prefix": "imp",
        "body": [
            "import $1 from '$2';"
        ],
        "description": "导入模块"
    },
    "if判断": {
        "prefix": "if",
        "body": [
            "if ($1) {",
            "  $2",
            "}"
        ],
        "description": "if语句"
    },
    "forEach循环": {
        "prefix": "fea",
        "body": [
            "$1.forEach(item => {",
            "  ",
            "})"
        ],
        "description": "forEach循环"
    },
    "map循环p": {
        "prefix": "map",
        "body": [
            "$1.map(item => {",
            "  ",
            "})"
        ],
        "description": "map循环"
    },
    "filter循环": {
        "prefix": "fil",
        "body": [
            "$1.filter(item => {",
            "  ",
            "})"
        ],
        "description": "filter循环"
    },
    "try-catch异常处理": {
        "prefix": "try",
        "body": [
            "try {",
            "  $1",
            "} catch (error) {",
            "  console.error(error);",
            "}"
        ],
        "description": "try-catch异常处理"
    },
    "if-else语句": {
        "prefix": "ife",
        "body": [
            "if ($1) {",
            "  $2",
            "} else {",
            "  $3",
            "}"
        ],
        "description": "if-else语句"
    },
    "Print to console": {
        "prefix": "cl",
        "body": [
            "console.log($1)"
        ],
        "description": "console.log()"
    },
    "Print to console,COLOR": {
        "prefix": "cc",
        "body": [
            "console.log(`%c${$1}`, 'color: skyblue; font-size: 20px;'); "
        ],
        "description": "console.log()---COLOR"
    },
    "Print to console result": {
        "prefix": "clr",
        "body": [
            "console.log('result',$1)"
        ],
        "description": "console.log('result',$1)"
    },
    "Print to console result JSON": {
        "prefix": "clrj",
        "body": [
            "console.log('result',JSON.stringify($1))"
        ],
        "description": "console.log('result',JSON.stringify($1))"
    },
    "for循环": {
        "prefix": "forl",
        "body": [
            "for (let i = 0; i < $1.length; i++) {",
            "    ",
            "}"
        ],
        "description": "for循环"
    },
    "jq获取ID元素": {
        "prefix": "jqi",
        "body": [
            "$('#$1')"
        ],
        "description": "jq获取ID元素"
    },
    "Print to JQ getElement by Class": {
        "prefix": "jqc",
        "body": [
            "$('.$1')"
        ],
        "description": "jq获取Class元素"
    },
    "Print to JQ click": {
        "prefix": "jqclick",
        "body": [
            "$('#$1').click(function () {",
            " ",
            "})"
        ],
        "description": "jq获取点击事件"
    },
    "Print to function": {
        "prefix": "fun",
        "body": [
            "function $1(params) {",
            " $2",
            "}"
        ],
        "description": "快捷function"
    },
    "判断是PC端还是移动端": {
        "prefix": "ispc",
        "body": [
            "if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {",
            " console.log('移动端')",
            "} else {",
            " console.log('PC端')",
            "}"
        ],
        "description": "判断是PC端还是移动端"
    },
    "阻止事件冒泡和默认事件": {
        "prefix": "zzmpmr",
        "body": [
            "let ev = window.event;",
            "if (ev && ev.stopPropagation) {",
            "//非IE浏览器",
            "ev.stopPropagation();",
            "} else {",
            "//IE浏览器(IE11以下)",
            "ev.cancelBubble = true;",
            "}",
            "//谷歌及IE8以上",
            "ev.preventDefault();"
        ],
        "description": "阻止事件冒泡和默认事件"
    }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值