-
首先在vscode编辑器中打开,【文件】–>【首选项】–>【用户片段】–>选择vue.json? -
{
"vue3": {
"prefix": "vue3",
"body": [
"<template>",
" <div>\n",
" </div>",
"</template>\n",
"<script lang='ts'>",
"import {defineComponent, reactive, toRefs, SetupContext} from 'vue'",
"interface Data {",
"}",
" export default defineComponent({",
" name: '',",
" props: {",
" },",
" components: {\n",
" },",
"setup(props, ctx: SetupContext){\n",
"const data: Data = reactive<Data>({",
"})",
"return {",
"...toRefs(data),",
"}",
"},",
" })",
"</script>\n",
"<style scoped lang='scss'>\n",
"</style>"
],
}
} 3.新建.vue结尾的文件,输入vue3 有提示,生成片段
|