vscode中设置vue代码片段

    科技2024-06-11  68

    vue 碎片

    { "Print to console": { "prefix": "vue", "body": [ "<template>", " <div class=\"${1}\">\n", " </div>", "</template>\n", "<script>", "export default {", " data () {", " return {\n", " }", " },", " mounted () {\n", " },", " methods: {\n", " }", "}", "</script>\n", "<style lang=\"less\" scoped>", "</style>\n" ], "description": "Create vue template" } }

    效果:

    <template> <div class=""> </div> </template> <script> export default { data () { return { } }, mounted () { }, methods: { } } </script> <style lang="less" scoped> </style>

    如何使用?

    左下角【管理 - 用户代码片段】 或者(左上角【文件 - 首选项 - 用户片段】) 然后选择 vue.json (没有就新建),将 上面的 json 粘贴进去即可,然后在空白 vue 文件 输入 vue 即可。

    Processed: 0.028, SQL: 8