vscode配置代码片段

1.ctrl + shift + p 然后选择 Snippets:Configure User Snippets (配置用户代码片段)

2.选择vue或者vue.json

3.下面为json内容

{

"vue-template": {

"prefix": "modal-table",

"body": [

"",

" <a-modal v-model:visible="visible" width="1000px" title="" :maskClosable="false" @ok="onOk">",

" <a-table bordered :columns="columns" :pagination="false" :data-source="list"> ",

" ",

"",

"",

"<script setup lang="tsx">",

"import { message } from 'ant-design-vue'",

"import request from '@/utils/request'",

"const emit = defineEmits('sure')",

"const visible = ref(false)",

"const list: any = ref(\[\])",

"const columns = [",

" {",

" title: '',",

" dataIndex: 'name',",

" align: 'center',",

" customRender: ({ record }: { record: any }) => {",

" return (",

" // prettier-ignore",

"
",
" )",
" }",
" },",
" {",
" title: '',",
" dataIndex: 'age',",
" align: 'center'",
" }",
"]",
"function onOk() {",
" emit('sure')",
" visible.value = false",
"}",
"function showModal() {",
" visible.value = true",
"}",
"defineExpose({ showModal })",
""
],
"description": "vue-template"
},
"vue-template": {
"prefix": "modal",
"body": "", " \", "", " ", "", "", "\