VS code 快速生成vue 模板

  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>
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容