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"
},
}

相关推荐
向着光芒的女孩4 小时前
【IDEA】关不了的Proxy Authentication弹框探索过程
java·ide·intellij-idea
椒盐螺丝钉5 小时前
Vue Router应用:组件跳转
前端·javascript·vue.js
天外飞雨道沧桑7 小时前
前端开发 Cursor MCP 提效工具配置
前端·vscode·ai编程·开发工具·cursor
芳草萋萋鹦鹉洲哦7 小时前
【vue】调用同页面其他组件方法几种新思路
前端·javascript·vue.js
悟能不能悟7 小时前
怎么在idea合并2个个branch
java·ide·intellij-idea
倦王8 小时前
vscode 中如何去选择不同的远程环境去debug
ide·vscode·编辑器
爱泡脚的鸡腿10 小时前
uni-app D4 实战(小兔鲜)
前端·vue.js·架构
广白10 小时前
钉钉小程序直传文件到 阿里云OSS
前端·vue.js·uni-app
摇滚侠11 小时前
Vue 项目实战《尚医通》,完成订单详情静态的搭建,笔记47
vue.js·笔记
焚 城11 小时前
Visual Studio 2026来临
ide·visual studio