vscode用户代码片段

2019-06-15  本文已影响0人  Gavin113

vue代码片段(xxx.code-snippets(全局))

// vue
{
    "Print to console": {
        "prefix": "vue",
        "body": [
            "<template>",
            "     <div class=\"${1:div}\">\n",
            "     </div>",
            "</template>\n",
            "<script>",
            "export default {",
            "    name:\"$2\",",
            "    components: {},",
            "    props: {},",
            "    data() {",
            "      return {\n",
            "      };",
            "    },",
            "    created() {},",
            "    mounted() {},",
            "    activited() {},",
            "    update() {},",
            "    beforeRouteUpdate() {},",
            "    methods: {\n",
            "    },",
            "    filter: {},",
            "    computed: {},",
            "    watch: {},",
            "};",
            "</script>\n",
            "<style lang=\"less\" scoped>\n",
            "</style>\n",
        ],
        "description": "Create vue template"
    }
}

JavaScript 代码片段 ( javascript.json )

{
    "Print to console": {
        "prefix": "cs",
        "body": [
            "console.log($1)"
        ],
        "description": "打印调试日志"
    },
        "validate Phone": {
        "prefix": "vPhone",
        "body": "var reg = /^1[34578]\d{9}$/",
        "description": "正则验证手机格式"
    },
    "validate Telephone": {
        "prefix": "vTel",
        "body": "var reg = /^0\d{2,3}-?\d{7,8}$/",
        "description": "正则验证固定电话"
    },
    "validate Password": {
        "prefix": "vPassword",
        "body": "var reg = /(?!^(\d+|[a-zA-Z]+|[~!@#$%^&*?]+)$)^[\w~!@#$%^&*?]+$/",
        "description": "正则验证密码,必须大小写英文,可带特殊字符"
    }
}
上一篇下一篇

猜你喜欢

热点阅读