隨後,最頂部命令塊會彈出很多語言或插件名
向下滾動選擇vue
打開後,粘貼如下代碼
{
"Print to console": {
"prefix": "vue",
"body": [
"<template>",
"<div class='$2'>$5</div>",
"</template>",
"",
"<script>",
"",
"export default {",
"name:'',",
"components: {},",
"data() {",
"return {",
"",
"};",
"},",
"computed: {},",
"watch: {},",
"methods: {",
"",
"},",
"//生命週期 - 創建完成(可以訪問當前this實例)",
"created() {",
"",
"},",
"//生命週期 - 掛載完成(可以訪問DOM元素)",
"mounted() {",
"",
"},",
"beforeCreate() {}, //生命週期 - 創建之前",
"beforeMount() {}, //生命週期 - 掛載之前",
"beforeUpdate() {}, //生命週期 - 更新之前",
"updated() {}, //生命週期 - 更新之後",
"beforeDestroy() {}, //生命週期 - 銷燬之前",
"destroyed() {}, //生命週期 - 銷燬完成",
"activated() {}, //如果頁面有keep-alive緩存功能,這個函數會觸發",
"}",
"</script>",
"<style lang='scss' scoped>",
"$4",
"</style>"
],
"description": "Log output to console"
}
}
重啓VSCODE
新建XXX.vue
編輯框輸入vue,按TAB鍵
出現如下