VS Code 快捷创建Vue模板

  1. 依次选中File->Preference->User Snippets
    在这里插入图片描述
  2. 输入vue进行搜索,然后点击打开vue.json
    在这里插入图片描述
  3. 将vue.json文件中的内容替换为以下内容
{
    "Print to console": {
            "prefix": "vue",
            "body": [
                    "<template>",
                    "  <div class='$1'></div>",
                    "</template>",
                    "",
                    "<script>",
                    "export default {",
                    "  name: '$1',",
                    "  data(){",
                    "    return {}",
                    "  },",
                    "  components: {},",
                    "  created(){},",
                    "  mounted(){},",
                    "  methods: {}",
                    "}",
                    "</script>",
                    "<style lang='scss' scoped>",
                    "</style>",
                    ""
            ],
            "description": "Log output to console"
    }
}
  1. 然后在新建的vue文件里面输入vue,就是显示提示,然后回车就变成了我们设置的模板了。
    在这里插入图片描述
发布了10 篇原创文章 · 获赞 7 · 访问量 2358

猜你喜欢

转载自blog.csdn.net/weixin_43142423/article/details/104554573