VSCODE快捷键

这个博客包含了大量实用的Vue.js和JavaScript代码片段,包括控制台输出、阻止默认事件、遍历数组和对象、axios请求、自定义指令注册等。此外,还涉及组件、插槽、数据、方法、过滤器等Vue特性的使用。这些代码片段可以帮助开发者快速编写日常项目中的常见功能。
摘要由CSDN通过智能技术生成

{

    // Place your snippets for JavaScript 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 letiables 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:

    "控制台输出": {

        "prefix": "log",

        "body": [

            "console.log($1)",

        ],

        "description": "控制台输出"

    },

    "阻止默认事件": {

        "prefix": "ep",

        "body": [

            "e.preventDefault()",

        ],

        "description": "阻止默认事件"

    },

    "遍历数组": {

        "prefix": "for",

        "body": [

            "for(let i = 0; i<arr.length; i++) {",

            "\tconsole.log(arr[i])",

            "}",

        ],

        "description": "遍历数组"

    },

   

    "遍历对象": {

        "prefix": "forin",

        "body": [

            "for(let key in obj){",

            "\tlet value = obj[key]",

            "}",

        ],

        "description": "遍历对象"

    },

    "axios": {

        "prefix": "axios",

        "body": [

            "axios({",

                "\turl:'请求路径',",

                "\tmethod:'get',",

                "\tdata: { 'post请求参数'},",

                "\tparams: { 'get请求参数'}",

            "}).then(res=>{",

                "\t//成功回调",

                "\tconsole.log(res)",

            "})",

        ],

        "description": "axios请求"

    },

    "背景颜色": {

        "prefix": "backgroundColor",

        "body": [

            "backgroundColor",

        ],

        "description": "背景颜色"

    },

    "compotents": {

        "prefix": "components:{}",

        "body": [

            "components:{$1}",

        ],

        "description": "compotents"

    },

    "slot": {

        "prefix": "<slot name=''></slot>",

        "body": [

            "<slot name='$1'></slot>",

        ],

        "description": "slot"

    },

    "v-slot": {

        "prefix": "v-slot:",

        "body": [

            "v-slot:",

        ],

        "description": "v-slot"

    },

    "全局自定义指令注册": {

        "prefix": "directive",

        "body": [

            "Vue.directive('focus', {",

                "\tinserted(el) {",

                    "\t\tel.focus()",

                "\t}",

            "})"

        ],

        "description": "全局注册"

    },

    "局部自定义指令注册": {

        "prefix": "directives",

        "body": [

            "directives: {",

                "\tfocus: {",

                    "\t\tinserted(el) {",

                        "\t\t\tel.focus()",

                    "\t\t}",

                "\t}",

            "}"

        ],

        "description": "局部注册"

    },

    "alert": {

        "prefix": "alert",

        "body": [

            "alert('$1')",

        ],

        "description": "alert()"

    },

    "prompt": {

        "prefix": "prompt",

        "body": [

            "prompt('$1')",

        ],

        "description": "prompt"

    },

    "mounted": {

        "prefix": "mounted",

        "body": [

            "mounted\t(){\n\t\t\t\n}",

        ],

        "description": "mounted"

    },

    "data": {

        "prefix": "data",

        "body": [

            "data(){\n\treturn{\t\n\t\t$1\n\t}\t\t\n},",

        ],

        "description": "data"

    },

    "methods": {

        "prefix": "methods",

        "body": [

            "methods:{\n\t$1\n},",

        ],

        "description": "methods"

    },

    "filters": {

        "prefix": "filters",

        "body": [

            "filters(){\n\t$1\n},",

        ],

        "description": "filters"

    },

    "parentNode.style.backgroundColor": {

        "prefix": "parentNode.style.backgroundColor",

        "body": [

            "parentNode.style.backgroundColor='$1'",

        ],

        "description": "parentNode.style.backgroundColor"

    },

    "parentNode.style": {

        "prefix": "parentNode.style",

        "body": [

            "parentNode.style",

        ],

        "description": "parentNode.style"

    },

    "constructor": {

        "prefix": "constructor",

        "body": [

            "constructor",

        ],

        "description": "constructor"

    },

   

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值