VSCode
- 文件->首选项->用户片段
- 搜索
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" } }