vscode vue自定義代碼片段snippets

打開編輯器>文件>首選項(xiàng)>用戶代碼片段>輸入vue>選中vue(其他語言類似)
以下是我個(gè)人的代碼片段,現(xiàn)把這份高效且規(guī)范的vue模板獻(xiàn)給各位前端隊(duì)員
祝大家0error 0waring

  • 用法prefix里面的vue-components


    Kapture 2020-08-18 at 17.16.12.gif
{
    // 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"
    // }
    "vue-components": {
        "prefix": "vue-components",
        "body": [
                "<template>",
                "\t<div class=\"$1\">",
                " ",
                "\t</div>",
                "</template>",
                " ",
                "<script>",
                "\/\/ import { xxx } from '@/xxx';",
                "export default {",
                "\tname: '',",
                "\tmixins: [],",
                "\tprops: {",
                "\t\tprop: {",
                "\t\t\ttype: String,",
                "\t\t\tdefault: '',",
                "\t\t}",
                "\t},",
                "\tcomponents: {",
                "\t},",
                "\tfilter: {",
                "\t},",
                "\tcomputed: {",
                "\t},",
                "\tdata() {",
                "\t\treturn {",
                "\t\t\tparams: ''",  
                "\t\t};",
                "\t},",
                "\twatch: {",
                "\t},",
                "\t\/\/ life cycle start",
                "\tbeforeCreate() {},",
                "\tcreated() {},",
                "\tbeforeMount() {},",
                "\tmounted() {},",
                "\tbeforeDestroy() {},",
                "\tdestroyed() {},",
                "\t\/\/ life cycle end",
                "\tmethods: {",
                "\t},",
                "};",
                "</script>",
                " ",
                "<style lang=\"scss\">",
                " ",
                "</style> "
        ],
        "description": "自定義vue組件代碼段"
    }
}
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容