美文网首页
VS code 快速生成vue 模板

VS code 快速生成vue 模板

作者: lvyweb | 来源:发表于2021-06-28 13:38 被阅读0次
  1. 使用快捷Ctrl + Shift + P唤出控制台,然后输入snippets并选择。(或 文件>首选项>用户代码片断里面,输入 vue.json ,然后回车 )(或 file > Preferences > User Snippets,当弹出搜索框之后,输入 vue.json ,然后回车)
  2. 接着输入vue,vs code自动生成vue.json文件。
  3. 将vue.json改成以下模板
{
    // Example:
    "Print to console": {
        "prefix": "vue",
        "body": [
            "<template>",
            "  <div class=\"content\">$0</div>",
            "</template>",
            "",
            "<script>",
            "export default {",
            "  components: {},",
            "  props: {},",
            "  data() {",
            "    return {",
            "    };",
            "  },",
            "  watch: {},",
            "  computed: {},",
            "  methods: {},",
            "  created() {},",
            "  mounted() {}",
            "};",
            "</script>",
            "<style lang=\"scss\" scoped>",
            ".content{}",
            "</style>"
        ],
        "description": "A vue file template"
    }
}
  1. 新建一个空白vue 输入vue,按下回车键或者Tab键,模板就自动生成了
  <template>
  <div class="content"></div>
</template>

<script>
export default {
  components: {},
  props: {},
  data() {
    return {
    };
  },
  watch: {},
  computed: {},
  methods: {},
  created() {},
  mounted() {}
};
</script>
<style lang="scss" scoped>
.content{}
</style>

相关文章

网友评论

      本文标题:VS code 快速生成vue 模板

      本文链接:https://www.haomeiwen.com/subject/sxyqultx.html