1. 程式人生 > >vs code建立vue模板

vs code建立vue模板

一字字敲vue模板是非常低效得事情,所以我搜索瞭如何在vs中建立vue模板方法,過程很簡單。

  1. 使用Ctrl + Shift + P召喚出控制檯,然後輸入snippets並選擇。
  2. 接著輸入vue,vs code自動生成vue.json檔案。
  3. 將檔案改為下面得模板(請根據個人需求修改當中的內容)
{
    // Example:
    "Print to console": {
        "prefix": "vue",
        "body": [
            "<template>",
            "  <div class=\"wrapper\"
>
$0</div>", "</template>", "", "<script>", "export default {", " components:{},", " props:{},", " data(){", " return {", " }", " },", " watch:{},", "
computed:{},", " methods:{},", " created(){},", " mouunted(){}", "}", "
</script>", "<style lang=\"scss\" scoped>", ".wrapper{}", "</style>" ], "description": "A vue file template" } }

最後在你的vue檔案中輸入vue就可以生成模板,是不是很神奇?