VSCode Note1:自定义代码片段

VSCode Note1:自定义代码片段

 

VSCode

  1. 文件->首选项->用户片段
  1. 搜索vue.json
// 自定义 "Print to console": { "prefix": "vv3", "body": [ "<template>", "\t<div>", "\t</div>", "</template>", "<script lang='ts'>", "import { defineComponent } from 'vue';", "export default defineComponent({", "\tname: 'App',", "\tcomponents: {},", "\tsetup() { }", "});", "</script>", "<style scoped lang='scss'>", "</style>" ], "description": "Log output to console" } }
修改
// 自定义 "Print to console": { "prefix": "vv3", "body": [ "<template>", "\t<div>", "\t</div>", "</template>", "<script lang='ts' setup>", "import { onMounted,inject,getCurrentInstance,reactive } from 'vue';", "let { proxy }: any = getCurrentInstance();", "onMounted(() => {})", "const state = reactive({})", "</script>", "<style scoped lang='scss'>", "</style>" ], "description": "Log output to console" } }