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": [
"",
" <a-modal v-model:visible="visible" width="1000px" title="" :maskClosable="false" @ok="onOk">",
"",
" ",
"",
"",
"<script setup lang="tsx">",
"import { message } from 'ant-design-vue'",
"import request from '@/utils/request'",
"const emit = defineEmits(['sure'])",
"const visible = ref(false)",
"function onOk() {",
" emit('sure')",
" visible.value = false",
"}",
"function showModal() {",
" visible.value = true",
"}",
"defineExpose({ showModal })",
""
],
"description": "vue-template"
},
}

相关推荐
Lkstar4 小时前
我把Vue2响应式源码从头到尾啃了一遍,这是整理笔记
vue.js
吴声子夜歌5 小时前
Vue3——新语法
前端·javascript·vue.js
jiayong235 小时前
第 36 课:任务详情抽屉快捷改状态
开发语言·前端·javascript·vue.js·学习
琢磨先生TT6 小时前
为什么很多后台系统功能不少,看起来却还是很廉价?
前端·vue.js·设计
玄月三初6 小时前
使用pandoc把word转换成markdown格式
vscode·word·markdown
533_7 小时前
[vscode] 禁止保存自动格式化
vscode
一 乐7 小时前
交通感知与车路协同系统|基于springboot + vue交通感知与车路协同系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·交通感知与车路协同系统
踩着两条虫9 小时前
强强联合!VTJ.PRO 正式接入 DeepSeek V4,AI 编码能力再跃升
前端·vue.js·ai编程
sz4972385999 小时前
vscode多种编译环境共存的方法
ide·vscode·stm32·编辑器·esp32