@ebiz/designer-components 0.1.124 → 0.1.126
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -29
- package/dist/designer-components.css +1 -1
- package/dist/index.mjs +35548 -33511
- package/dist/{pdf-C9oIcL2N.js → pdf-KomaE0u5.js} +891 -891
- package/package.json +1 -1
- package/src/App.vue +26 -26
- package/src/apiService/SIMPLE_DATA_SERVICE.md +284 -284
- package/src/apiService/mockDataService.js +115 -115
- package/src/apiService/simpleDataService.js +312 -312
- package/src/assets/base.css +86 -86
- package/src/assets/logo.svg +1 -1
- package/src/components/Button.vue +149 -149
- package/src/components/DataContainer.vue +40 -40
- package/src/components/EbizApproval.vue +366 -366
- package/src/components/EbizApprovalDetail.vue +169 -169
- package/src/components/EbizApprovalForm.vue +534 -534
- package/src/components/EbizApprovalV2.vue +713 -713
- package/src/components/EbizAutoForm.vue +596 -596
- package/src/components/EbizAvatar.vue +115 -115
- package/src/components/EbizCheckbox.vue +93 -93
- package/src/components/EbizCheckboxGroup.vue +69 -69
- package/src/components/EbizDepartmentSelector.vue +148 -148
- package/src/components/EbizDescriptions.vue +340 -340
- package/src/components/EbizDescriptionsItem.vue +47 -47
- package/src/components/EbizDetailBlock.vue +81 -81
- package/src/components/EbizDetailItem.vue +559 -559
- package/src/components/EbizDetailView.md +438 -438
- package/src/components/EbizDetailView.vue +355 -355
- package/src/components/EbizDialog.vue +260 -260
- package/src/components/EbizDictionarySelect.vue +229 -229
- package/src/components/EbizDiv.vue +40 -40
- package/src/components/EbizDivider.vue +96 -96
- package/src/components/EbizDormDashboard.vue +314 -314
- package/src/components/EbizDropdown.vue +135 -135
- package/src/components/EbizDropdownItem.vue +85 -85
- package/src/components/EbizEmployeeInfo.vue +144 -144
- package/src/components/EbizEmployeeSelector.vue +1160 -1160
- package/src/components/EbizFileList.vue +502 -502
- package/src/components/EbizMap.vue +541 -541
- package/src/components/EbizMeetingRoomSelector.vue +1149 -1149
- package/src/components/EbizMobileMeetingRoomSelector.vue +727 -727
- package/src/components/EbizOkrTree.vue +99 -99
- package/src/components/EbizPageHeader.vue +98 -98
- package/src/components/EbizPagination.vue +162 -162
- package/src/components/EbizParkingDashboard.vue +152 -152
- package/src/components/EbizPdfViewer.vue +540 -540
- package/src/components/EbizPopconfirm.vue +47 -47
- package/src/components/EbizQrCode.vue +167 -167
- package/src/components/EbizRadio.vue +86 -86
- package/src/components/EbizRadioGroup.vue +83 -83
- package/src/components/EbizRemoteSelect.vue +232 -232
- package/src/components/EbizRichTextEditor.vue +338 -338
- package/src/components/EbizRouteBreadcrumb.vue +46 -46
- package/src/components/EbizSApprovalProcess.vue +1456 -1426
- package/src/components/EbizSelect.vue +85 -85
- package/src/components/EbizSpace.vue +100 -100
- package/src/components/EbizStatistic.vue +149 -149
- package/src/components/EbizStatsCard.vue +113 -113
- package/src/components/EbizSwiper.vue +113 -113
- package/src/components/EbizSwiperItem.vue +13 -13
- package/src/components/EbizSwitch.vue +85 -85
- package/src/components/EbizTabHeader.vue +132 -132
- package/src/components/EbizTabPanel.vue +22 -22
- package/src/components/EbizTable.vue +469 -469
- package/src/components/EbizTableColumn.vue +116 -116
- package/src/components/EbizTableSort.vue +179 -179
- package/src/components/EbizTabs.vue +142 -142
- package/src/components/EbizTdesignButtonDialog.vue +332 -332
- package/src/components/EbizTdesignLoading.vue +107 -107
- package/src/components/EbizTimePicker.vue +143 -143
- package/src/components/EbizTitle.vue +91 -91
- package/src/components/EbizTree.vue +141 -141
- package/src/components/EbizTreeMergeTable.vue +1494 -1494
- package/src/components/EbizTreeSelector.vue +469 -469
- package/src/components/EbizVideo.vue +553 -553
- package/src/components/EbizVxeTable.vue +290 -290
- package/src/components/Form.vue +28 -28
- package/src/components/Home.vue +7 -7
- package/src/components/LaunchInterview.vue +526 -526
- package/src/components/MyComponent.vue +39 -39
- package/src/components/Table.vue +45 -45
- package/src/components/TdesignAlert.vue +115 -115
- package/src/components/TdesignButton.vue +135 -135
- package/src/components/TdesignCalendar/index.vue +145 -145
- package/src/components/TdesignCard.vue +195 -195
- package/src/components/TdesignCol.vue +101 -101
- package/src/components/TdesignCollapse.vue +142 -142
- package/src/components/TdesignCollapsePanel.vue +79 -79
- package/src/components/TdesignDatePicker.vue +124 -124
- package/src/components/TdesignDescriptions.vue +74 -74
- package/src/components/TdesignDescriptionsItem.vue +50 -50
- package/src/components/TdesignDialog.vue +225 -225
- package/src/components/TdesignForm.vue +138 -138
- package/src/components/TdesignFormItem.vue +105 -105
- package/src/components/TdesignGrid.vue +55 -55
- package/src/components/TdesignIcon.vue +67 -67
- package/src/components/TdesignImage.vue +162 -162
- package/src/components/TdesignImageViewer.vue +200 -200
- package/src/components/TdesignInput.vue +242 -242
- package/src/components/TdesignSelect.vue +446 -446
- package/src/components/TdesignTag.vue +117 -117
- package/src/components/TdesignTextarea.vue +142 -142
- package/src/components/TdesignTimeline.vue +58 -58
- package/src/components/TdesignTimelineItem.vue +71 -71
- package/src/components/TdesignUpload.vue +414 -414
- package/src/components/TdesignWatermark.vue +107 -107
- package/src/components/ebiz-form/components/cascader.vue +61 -61
- package/src/components/ebiz-form/components/checkbox.vue +37 -37
- package/src/components/ebiz-form/components/city.vue +137 -137
- package/src/components/ebiz-form/components/date-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range-panel.vue +52 -52
- package/src/components/ebiz-form/components/date-range.vue +56 -56
- package/src/components/ebiz-form/components/date.vue +52 -52
- package/src/components/ebiz-form/components/editor-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/editor.vue +78 -78
- package/src/components/ebiz-form/components/file-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/file.vue +149 -149
- package/src/components/ebiz-form/components/images-multi-language.vue +52 -52
- package/src/components/ebiz-form/components/images.vue +129 -129
- package/src/components/ebiz-form/components/img-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/img.vue +129 -129
- package/src/components/ebiz-form/components/number.vue +50 -50
- package/src/components/ebiz-form/components/radio.vue +28 -28
- package/src/components/ebiz-form/components/select.vue +119 -119
- package/src/components/ebiz-form/components/switch.vue +23 -23
- package/src/components/ebiz-form/components/text-multi-language.vue +47 -47
- package/src/components/ebiz-form/components/text.vue +52 -52
- package/src/components/ebiz-form/components/textarea-multi-language.vue +48 -48
- package/src/components/ebiz-form/components/textarea.vue +29 -29
- package/src/components/ebiz-form/components/video-multi-language.vue +51 -51
- package/src/components/ebiz-form/components/video.vue +97 -97
- package/src/components/ebiz-form/index.vue +157 -157
- package/src/components/examples/PopconfirmExample.vue +149 -149
- package/src/components/icons/IconCommunity.vue +7 -7
- package/src/components/icons/IconDocumentation.vue +7 -7
- package/src/components/icons/IconEcosystem.vue +7 -7
- package/src/components/icons/IconSupport.vue +7 -7
- package/src/components/icons/IconTooling.vue +19 -19
- package/src/components/mItems/UserInfo.vue +349 -349
- package/src/components/senior/EbizApprovalList/ApprovalList.vue +127 -127
- package/src/components/senior/EbizSData/index.vue +280 -280
- package/src/components/senior/EbizSDialog/index.vue +776 -776
- package/src/components/senior/EbizSForm/README.md +157 -157
- package/src/components/senior/EbizSForm/index.vue +667 -667
- package/src/components/senior/EbizSForm/item.vue +1011 -1011
- package/src/components/senior/EbizSForm/mItems/DateTimePicker.vue +51 -51
- package/src/components/senior/EbizSForm/mItems/Picker.vue +63 -63
- package/src/index.js +327 -327
- package/src/main.js +55 -55
- package/src/router/index.js +436 -436
- package/src/utils/formatCode.js +24 -24
- package/src/utils/generateImportStatement.js +52 -52
- package/src/utils/hasJsx.js +25 -25
- package/src/utils/index.js +166 -166
- package/src/utils/mergeOptions.js +29 -29
- package/src/utils/parseRequiredBlocks.js +18 -18
- package/src/utils/vue-sfc-validator.js +155 -155
- package/src/views/Button.vue +23 -23
- package/src/views/CheckboxDemo.vue +104 -104
- package/src/views/DataContainer.vue +19 -19
- package/src/views/DialogDemo.vue +125 -125
- package/src/views/EbizApprovalDemo.vue +87 -87
- package/src/views/EbizApprovalFormDemo.vue +207 -207
- package/src/views/EbizAutoFormDemo.vue +129 -129
- package/src/views/EbizAvatar.vue +223 -223
- package/src/views/EbizDepartmentSelectorDemo.vue +169 -169
- package/src/views/EbizDetailBlockDemo.vue +30 -30
- package/src/views/EbizDetailViewDemo.vue +412 -412
- package/src/views/EbizDormDashboardDemo.vue +87 -87
- package/src/views/EbizEmployeeInfo.vue +249 -249
- package/src/views/EbizEmployeeSelector.vue +85 -85
- package/src/views/EbizFileListDemo.vue +339 -339
- package/src/views/EbizMap.vue +201 -201
- package/src/views/EbizMeetingRoomSelectorDemo.vue +293 -293
- package/src/views/EbizMobileMeetingRoomSelectorDemo.vue +566 -566
- package/src/views/EbizParkingDashboardDemo.vue +28 -28
- package/src/views/EbizRadioDemo.vue +151 -151
- package/src/views/EbizSDataDemo.vue +136 -136
- package/src/views/EbizSDialogDemo.vue +303 -303
- package/src/views/EbizSForm/index.vue +352 -352
- package/src/views/EbizSFormDemo.vue +420 -420
- package/src/views/EbizSpace.vue +185 -185
- package/src/views/EbizSwiper.vue +157 -157
- package/src/views/EbizTdesignButtonDialogExample.vue +437 -437
- package/src/views/Form.vue +19 -19
- package/src/views/GridDemo.vue +238 -238
- package/src/views/Home.vue +156 -156
- package/src/views/LaunchInterviewDemo.vue +111 -111
- package/src/views/Mindmap.vue +17 -17
- package/src/views/MyComponent.vue +19 -19
- package/src/views/OkrTree.vue +19 -19
- package/src/views/PageHeaderDemo.vue +104 -104
- package/src/views/PaginationDemo.vue +96 -96
- package/src/views/PdfViewerDemo.vue +433 -433
- package/src/views/PermissionBoxDemo.vue +85 -85
- package/src/views/PopconfirmDemo.vue +80 -80
- package/src/views/RemoteSelect.vue +350 -350
- package/src/views/StatisticDemo.vue +190 -190
- package/src/views/SwitchDemo.vue +79 -79
- package/src/views/Table.vue +19 -19
- package/src/views/TableDemo.vue +334 -334
- package/src/views/TableSortDemo.vue +143 -143
- package/src/views/TableView.vue +68 -68
- package/src/views/TabsDemo.vue +282 -282
- package/src/views/TagDemo.vue +101 -101
- package/src/views/TdesignAlert.vue +98 -98
- package/src/views/TdesignButton.vue +190 -190
- package/src/views/TdesignCalendar.vue +94 -94
- package/src/views/TdesignCard.vue +296 -296
- package/src/views/TdesignCollapse.vue +293 -293
- package/src/views/TdesignDatePicker.vue +187 -187
- package/src/views/TdesignDescriptions.vue +101 -101
- package/src/views/TdesignForm.vue +248 -248
- package/src/views/TdesignIcon.vue +203 -203
- package/src/views/TdesignImage.vue +215 -215
- package/src/views/TdesignImageViewer.vue +198 -198
- package/src/views/TdesignInput.vue +252 -252
- package/src/views/TdesignSelect.vue +473 -473
- package/src/views/TdesignSwiper.vue +157 -157
- package/src/views/TextareaDemo.vue +93 -93
- package/src/views/TimePickerDemo.vue +146 -146
- package/src/views/TimelineDemo.vue +160 -160
- package/src/views/Title.vue +19 -19
- package/src/views/TreeDemo.vue +254 -254
- package/src/views/TreeMergeTableDemo.vue +239 -239
- package/src/views/TreeSelectorDemo.vue +245 -245
- package/src/views/UploadDemo.vue +128 -128
- package/src/views/VideoDemo.vue +245 -245
- package/src/views/VxeTableDemo.vue +279 -279
- package/src/views/WatermarkDemo.vue +85 -85
|
@@ -1,438 +1,438 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="example-container">
|
|
3
|
-
<h2>弹窗按钮组件示例</h2>
|
|
4
|
-
|
|
5
|
-
<div class="example-section">
|
|
6
|
-
<h3>弹窗类型示例</h3>
|
|
7
|
-
<p>弹窗按钮组件支持三种类型:普通弹窗、添加数据弹窗和删除数据弹窗</p>
|
|
8
|
-
|
|
9
|
-
<div class="button-group">
|
|
10
|
-
<EbizTdesignButtonDialog
|
|
11
|
-
dialog-type="normal"
|
|
12
|
-
button-text="普通弹窗"
|
|
13
|
-
title="普通弹窗示例"
|
|
14
|
-
dialog-width="500px"
|
|
15
|
-
confirm-text="确认"
|
|
16
|
-
cancel-text="取消"
|
|
17
|
-
button-theme="primary"
|
|
18
|
-
>
|
|
19
|
-
<template #body>
|
|
20
|
-
<div class="dialog-content">
|
|
21
|
-
<p>这是一个普通弹窗示例。</p>
|
|
22
|
-
<p>普通弹窗主要用于显示信息、提示用户或操作确认。</p>
|
|
23
|
-
<p>普通弹窗使用配置的主题。</p>
|
|
24
|
-
</div>
|
|
25
|
-
</template>
|
|
26
|
-
</EbizTdesignButtonDialog>
|
|
27
|
-
|
|
28
|
-
<EbizTdesignButtonDialog
|
|
29
|
-
dialog-type="add"
|
|
30
|
-
button-text="添加数据"
|
|
31
|
-
title="添加数据"
|
|
32
|
-
dialog-width="500px"
|
|
33
|
-
confirm-text="确认添加"
|
|
34
|
-
cancel-text="取消"
|
|
35
|
-
button-theme="success"
|
|
36
|
-
button-icon="add"
|
|
37
|
-
:api-config="addApiConfig"
|
|
38
|
-
@api-success="handleAddSuccess"
|
|
39
|
-
@api-error="handleApiError"
|
|
40
|
-
>
|
|
41
|
-
<template #body>
|
|
42
|
-
<div class="dialog-content">
|
|
43
|
-
<p>这是一个添加数据弹窗示例。</p>
|
|
44
|
-
<p>添加数据弹窗主要用于添加新数据,使用绿色主题。</p>
|
|
45
|
-
<t-form ref="addForm">
|
|
46
|
-
<t-form-item label="名称">
|
|
47
|
-
<t-input v-model="formData.name" placeholder="请输入名称" />
|
|
48
|
-
</t-form-item>
|
|
49
|
-
<t-form-item label="描述">
|
|
50
|
-
<t-textarea v-model="formData.description" placeholder="请输入描述" />
|
|
51
|
-
</t-form-item>
|
|
52
|
-
</t-form>
|
|
53
|
-
</div>
|
|
54
|
-
</template>
|
|
55
|
-
</EbizTdesignButtonDialog>
|
|
56
|
-
|
|
57
|
-
<EbizTdesignButtonDialog
|
|
58
|
-
dialog-type="delete"
|
|
59
|
-
button-text="删除数据"
|
|
60
|
-
title="删除确认"
|
|
61
|
-
confirm-text="确认删除"
|
|
62
|
-
cancel-text="取消"
|
|
63
|
-
button-theme="danger"
|
|
64
|
-
button-icon="delete"
|
|
65
|
-
:api-config="deleteApiConfig"
|
|
66
|
-
@api-success="handleDeleteSuccess"
|
|
67
|
-
@api-error="handleApiError"
|
|
68
|
-
>
|
|
69
|
-
<template #body>
|
|
70
|
-
<div class="delete-confirm-content">
|
|
71
|
-
<t-icon name="error-circle" size="large" style="color: #e34d59; margin-right: 12px;" />
|
|
72
|
-
<p style="margin: 0; font-size: 14px;">确定要删除该数据吗?此操作不可逆,请谨慎操作。</p>
|
|
73
|
-
</div>
|
|
74
|
-
</template>
|
|
75
|
-
</EbizTdesignButtonDialog>
|
|
76
|
-
</div>
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<div class="example-section">
|
|
80
|
-
<t-switch v-model="visible" label="控制弹窗显示"></t-switch>
|
|
81
|
-
<h3>基础用法</h3>
|
|
82
|
-
<EbizTdesignButtonDialog
|
|
83
|
-
:visible="visible"
|
|
84
|
-
button-text="打开基础弹窗"
|
|
85
|
-
title="基础弹窗"
|
|
86
|
-
button-theme="primary"
|
|
87
|
-
dialog-width="500px"
|
|
88
|
-
confirm-text="确认"
|
|
89
|
-
cancel-text="取消"
|
|
90
|
-
@button-click="handleButtonClick"
|
|
91
|
-
@dialog-close="handleDialogClose"
|
|
92
|
-
@dialog-confirm="handleDialogConfirm"
|
|
93
|
-
@dialog-cancel="handleDialogCancel"
|
|
94
|
-
>
|
|
95
|
-
<template #body>
|
|
96
|
-
<div class="dialog-content">
|
|
97
|
-
这是一个基础的弹窗内容
|
|
98
|
-
</div>
|
|
99
|
-
</template>
|
|
100
|
-
</EbizTdesignButtonDialog>
|
|
101
|
-
</div>
|
|
102
|
-
|
|
103
|
-
<div class="example-section">
|
|
104
|
-
<h3>自定义按钮内容</h3>
|
|
105
|
-
<EbizTdesignButtonDialog
|
|
106
|
-
title="自定义按钮"
|
|
107
|
-
button-theme="success"
|
|
108
|
-
button-variant="outline"
|
|
109
|
-
dialog-width="500px"
|
|
110
|
-
confirm-text="确认"
|
|
111
|
-
cancel-text="取消"
|
|
112
|
-
>
|
|
113
|
-
<template #buttonContent>
|
|
114
|
-
<t-icon name="add" />
|
|
115
|
-
添加内容
|
|
116
|
-
</template>
|
|
117
|
-
<template #body>
|
|
118
|
-
<div class="dialog-content">
|
|
119
|
-
这是一个带有自定义按钮内容的弹窗
|
|
120
|
-
</div>
|
|
121
|
-
</template>
|
|
122
|
-
</EbizTdesignButtonDialog>
|
|
123
|
-
</div>
|
|
124
|
-
|
|
125
|
-
<div class="example-section">
|
|
126
|
-
<h3>自定义弹窗内容</h3>
|
|
127
|
-
<EbizTdesignButtonDialog
|
|
128
|
-
button-text="打开表单弹窗"
|
|
129
|
-
title="表单弹窗"
|
|
130
|
-
button-theme="warning"
|
|
131
|
-
button-size="large"
|
|
132
|
-
dialog-width="600px"
|
|
133
|
-
dialog-mode="modal"
|
|
134
|
-
dialog-placement="center"
|
|
135
|
-
confirm-text="提交"
|
|
136
|
-
cancel-text="取消"
|
|
137
|
-
>
|
|
138
|
-
<template #header>
|
|
139
|
-
<div class="custom-header">
|
|
140
|
-
<t-icon name="edit" />
|
|
141
|
-
自定义标题
|
|
142
|
-
</div>
|
|
143
|
-
</template>
|
|
144
|
-
<template #body>
|
|
145
|
-
<div class="dialog-content">
|
|
146
|
-
<t-form>
|
|
147
|
-
<t-form-item label="姓名">
|
|
148
|
-
<t-input placeholder="请输入姓名" />
|
|
149
|
-
</t-form-item>
|
|
150
|
-
<t-form-item label="年龄">
|
|
151
|
-
<t-input-number placeholder="请输入年龄" />
|
|
152
|
-
</t-form-item>
|
|
153
|
-
</t-form>
|
|
154
|
-
</div>
|
|
155
|
-
</template>
|
|
156
|
-
<template #footer>
|
|
157
|
-
<t-space>
|
|
158
|
-
<t-button theme="default" @click="handleDialogCancel">取消</t-button>
|
|
159
|
-
<t-button theme="primary" @click="handleDialogConfirm">提交</t-button>
|
|
160
|
-
</t-space>
|
|
161
|
-
</template>
|
|
162
|
-
</EbizTdesignButtonDialog>
|
|
163
|
-
</div>
|
|
164
|
-
|
|
165
|
-
<div class="example-section">
|
|
166
|
-
<h3>更多按钮样式</h3>
|
|
167
|
-
<div class="button-group">
|
|
168
|
-
<EbizTdesignButtonDialog
|
|
169
|
-
button-text="圆形按钮"
|
|
170
|
-
button-shape="circle"
|
|
171
|
-
button-theme="primary"
|
|
172
|
-
dialog-width="400px"
|
|
173
|
-
confirm-text="确认"
|
|
174
|
-
cancel-text="取消"
|
|
175
|
-
>
|
|
176
|
-
<template #body>圆形按钮示例</template>
|
|
177
|
-
</EbizTdesignButtonDialog>
|
|
178
|
-
|
|
179
|
-
<EbizTdesignButtonDialog
|
|
180
|
-
button-text="方形按钮"
|
|
181
|
-
button-shape="square"
|
|
182
|
-
button-theme="success"
|
|
183
|
-
dialog-width="400px"
|
|
184
|
-
confirm-text="确认"
|
|
185
|
-
cancel-text="取消"
|
|
186
|
-
>
|
|
187
|
-
<template #body>方形按钮示例</template>
|
|
188
|
-
</EbizTdesignButtonDialog>
|
|
189
|
-
|
|
190
|
-
<EbizTdesignButtonDialog
|
|
191
|
-
button-text="文字按钮"
|
|
192
|
-
button-variant="text"
|
|
193
|
-
button-theme="danger"
|
|
194
|
-
dialog-width="400px"
|
|
195
|
-
confirm-text="确认"
|
|
196
|
-
cancel-text="取消"
|
|
197
|
-
>
|
|
198
|
-
<template #body>文字按钮示例</template>
|
|
199
|
-
</EbizTdesignButtonDialog>
|
|
200
|
-
|
|
201
|
-
<EbizTdesignButtonDialog
|
|
202
|
-
button-icon="add"
|
|
203
|
-
button-text="带图标按钮"
|
|
204
|
-
button-theme="default"
|
|
205
|
-
dialog-width="400px"
|
|
206
|
-
confirm-text="确认"
|
|
207
|
-
cancel-text="取消"
|
|
208
|
-
>
|
|
209
|
-
<template #body>带图标按钮示例</template>
|
|
210
|
-
</EbizTdesignButtonDialog>
|
|
211
|
-
</div>
|
|
212
|
-
</div>
|
|
213
|
-
|
|
214
|
-
<div class="example-section">
|
|
215
|
-
<h3>API接口调用示例</h3>
|
|
216
|
-
<p>点击按钮后,弹窗确认时会调用接口,并根据接口结果触发对应事件</p>
|
|
217
|
-
|
|
218
|
-
<div class="button-group">
|
|
219
|
-
<EbizTdesignButtonDialog
|
|
220
|
-
button-text="提交数据"
|
|
221
|
-
button-theme="primary"
|
|
222
|
-
title="提交数据"
|
|
223
|
-
dialog-width="500px"
|
|
224
|
-
confirm-text="确认"
|
|
225
|
-
cancel-text="取消"
|
|
226
|
-
:api-config="successApiConfig"
|
|
227
|
-
@api-success="handleApiSuccess"
|
|
228
|
-
@api-error="handleApiError"
|
|
229
|
-
>
|
|
230
|
-
<template #body>
|
|
231
|
-
<div class="dialog-content">
|
|
232
|
-
<p>这个示例配置了一个成功的API调用。</p>
|
|
233
|
-
<p>点击确认按钮时,将提交以下数据:</p>
|
|
234
|
-
<t-code-block :code="JSON.stringify(successApiConfig, null, 2)" lang="json" />
|
|
235
|
-
<p>接口调用成功后会自动关闭弹窗并触发api-success事件。</p>
|
|
236
|
-
</div>
|
|
237
|
-
</template>
|
|
238
|
-
</EbizTdesignButtonDialog>
|
|
239
|
-
|
|
240
|
-
<EbizTdesignButtonDialog
|
|
241
|
-
button-text="错误请求"
|
|
242
|
-
button-theme="danger"
|
|
243
|
-
title="错误请求"
|
|
244
|
-
dialog-width="500px"
|
|
245
|
-
confirm-text="确认"
|
|
246
|
-
cancel-text="取消"
|
|
247
|
-
:api-config="errorApiConfig"
|
|
248
|
-
@api-success="handleApiSuccess"
|
|
249
|
-
@api-error="handleApiError"
|
|
250
|
-
>
|
|
251
|
-
<template #body>
|
|
252
|
-
<div class="dialog-content">
|
|
253
|
-
<p>这个示例配置了一个失败的API调用。</p>
|
|
254
|
-
<p>点击确认按钮时,将尝试请求:</p>
|
|
255
|
-
<t-code-block :code="JSON.stringify(errorApiConfig, null, 2)" lang="json" />
|
|
256
|
-
<p>接口调用失败后会显示错误消息并触发api-error事件。</p>
|
|
257
|
-
</div>
|
|
258
|
-
</template>
|
|
259
|
-
</EbizTdesignButtonDialog>
|
|
260
|
-
|
|
261
|
-
<EbizTdesignButtonDialog
|
|
262
|
-
button-text="自定义配置"
|
|
263
|
-
button-theme="success"
|
|
264
|
-
title="自定义API配置"
|
|
265
|
-
dialog-width="500px"
|
|
266
|
-
confirm-text="确认"
|
|
267
|
-
cancel-text="取消"
|
|
268
|
-
:api-config="successApiConfig"
|
|
269
|
-
:close-on-success="false"
|
|
270
|
-
:show-result-message="false"
|
|
271
|
-
@api-success="handleCustomApiSuccess"
|
|
272
|
-
>
|
|
273
|
-
<template #body>
|
|
274
|
-
<div class="dialog-content">
|
|
275
|
-
<p>这个示例配置了自定义的API行为。</p>
|
|
276
|
-
<p>设置了以下选项:</p>
|
|
277
|
-
<ul>
|
|
278
|
-
<li>关闭成功后自动关闭弹窗的选项</li>
|
|
279
|
-
<li>关闭显示结果消息的选项</li>
|
|
280
|
-
<li>自定义处理成功事件,显示自定义消息</li>
|
|
281
|
-
</ul>
|
|
282
|
-
<p v-if="apiResult">
|
|
283
|
-
<strong>API调用结果:</strong>
|
|
284
|
-
<t-tag theme="success">{{ apiResult }}</t-tag>
|
|
285
|
-
</p>
|
|
286
|
-
</div>
|
|
287
|
-
</template>
|
|
288
|
-
</EbizTdesignButtonDialog>
|
|
289
|
-
</div>
|
|
290
|
-
</div>
|
|
291
|
-
</div>
|
|
292
|
-
</template>
|
|
293
|
-
|
|
294
|
-
<script setup>
|
|
295
|
-
import { EbizTdesignButtonDialog } from '../index.js'
|
|
296
|
-
import { ref, reactive } from 'vue'
|
|
297
|
-
import {
|
|
298
|
-
Switch as TSwitch,
|
|
299
|
-
Form as TForm,
|
|
300
|
-
FormItem as TFormItem,
|
|
301
|
-
Input as TInput,
|
|
302
|
-
InputNumber as TInputNumber,
|
|
303
|
-
Space as TSpace,
|
|
304
|
-
Button as TButton,
|
|
305
|
-
Icon as TIcon,
|
|
306
|
-
Tag as TTag,
|
|
307
|
-
CodeBlock as TCodeBlock,
|
|
308
|
-
MessagePlugin,
|
|
309
|
-
Textarea as TTextarea
|
|
310
|
-
} from 'tdesign-vue-next'
|
|
311
|
-
|
|
312
|
-
const visible = ref(false)
|
|
313
|
-
const apiResult = ref(null)
|
|
314
|
-
|
|
315
|
-
// 表单数据
|
|
316
|
-
const formData = reactive({
|
|
317
|
-
name: '',
|
|
318
|
-
description: ''
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
// 添加数据API配置
|
|
322
|
-
const addApiConfig = {
|
|
323
|
-
url: '/api/items',
|
|
324
|
-
method: 'post',
|
|
325
|
-
data: formData
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
// 删除数据API配置
|
|
329
|
-
const deleteApiConfig = {
|
|
330
|
-
url: '/api/items/123',
|
|
331
|
-
method: 'delete'
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
// 模拟成功的API配置
|
|
335
|
-
const successApiConfig = {
|
|
336
|
-
url: '/api/success',
|
|
337
|
-
method: 'post',
|
|
338
|
-
data: {
|
|
339
|
-
name: '测试数据',
|
|
340
|
-
value: 100
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
// 模拟失败的API配置
|
|
345
|
-
const errorApiConfig = {
|
|
346
|
-
url: '/api/error',
|
|
347
|
-
method: 'get'
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
const handleButtonClick = (e) => {
|
|
351
|
-
console.log('按钮点击事件', e)
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
const handleDialogClose = (e) => {
|
|
355
|
-
console.log('弹窗关闭事件', e)
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
const handleDialogConfirm = (e) => {
|
|
359
|
-
console.log('弹窗确认事件', e)
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
const handleDialogCancel = (e) => {
|
|
363
|
-
console.log('弹窗取消事件', e)
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
// API相关事件处理
|
|
367
|
-
const handleApiSuccess = (response) => {
|
|
368
|
-
console.log('API调用成功:', response)
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
const handleAddSuccess = (response) => {
|
|
372
|
-
console.log('添加数据成功:', response)
|
|
373
|
-
// 添加成功后清空表单
|
|
374
|
-
formData.name = ''
|
|
375
|
-
formData.description = ''
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
const handleDeleteSuccess = (response) => {
|
|
379
|
-
console.log('删除数据成功:', response)
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
const handleApiError = (error) => {
|
|
383
|
-
console.log('API调用失败:', error)
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// 自定义API成功处理
|
|
387
|
-
const handleCustomApiSuccess = (response) => {
|
|
388
|
-
console.log('自定义API成功处理:', response)
|
|
389
|
-
apiResult.value = '接口调用成功!'
|
|
390
|
-
MessagePlugin.success({
|
|
391
|
-
content: '自定义成功消息:接口调用成功',
|
|
392
|
-
duration: 3000
|
|
393
|
-
})
|
|
394
|
-
}
|
|
395
|
-
</script>
|
|
396
|
-
|
|
397
|
-
<style scoped>
|
|
398
|
-
.example-container {
|
|
399
|
-
padding: 20px;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
.example-section {
|
|
403
|
-
margin-bottom: 30px;
|
|
404
|
-
border-bottom: 1px solid #eee;
|
|
405
|
-
padding-bottom: 20px;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
.example-section h3 {
|
|
409
|
-
margin-bottom: 16px;
|
|
410
|
-
font-size: 16px;
|
|
411
|
-
color: #333;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
.dialog-content {
|
|
415
|
-
padding: 20px;
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
.custom-header {
|
|
419
|
-
display: flex;
|
|
420
|
-
align-items: center;
|
|
421
|
-
gap: 8px;
|
|
422
|
-
font-size: 16px;
|
|
423
|
-
font-weight: bold;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
.button-group {
|
|
427
|
-
display: flex;
|
|
428
|
-
gap: 16px;
|
|
429
|
-
flex-wrap: wrap;
|
|
430
|
-
margin-top: 16px;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
.delete-confirm-content {
|
|
434
|
-
display: flex;
|
|
435
|
-
align-items: center;
|
|
436
|
-
padding: 16px;
|
|
437
|
-
}
|
|
1
|
+
<template>
|
|
2
|
+
<div class="example-container">
|
|
3
|
+
<h2>弹窗按钮组件示例</h2>
|
|
4
|
+
|
|
5
|
+
<div class="example-section">
|
|
6
|
+
<h3>弹窗类型示例</h3>
|
|
7
|
+
<p>弹窗按钮组件支持三种类型:普通弹窗、添加数据弹窗和删除数据弹窗</p>
|
|
8
|
+
|
|
9
|
+
<div class="button-group">
|
|
10
|
+
<EbizTdesignButtonDialog
|
|
11
|
+
dialog-type="normal"
|
|
12
|
+
button-text="普通弹窗"
|
|
13
|
+
title="普通弹窗示例"
|
|
14
|
+
dialog-width="500px"
|
|
15
|
+
confirm-text="确认"
|
|
16
|
+
cancel-text="取消"
|
|
17
|
+
button-theme="primary"
|
|
18
|
+
>
|
|
19
|
+
<template #body>
|
|
20
|
+
<div class="dialog-content">
|
|
21
|
+
<p>这是一个普通弹窗示例。</p>
|
|
22
|
+
<p>普通弹窗主要用于显示信息、提示用户或操作确认。</p>
|
|
23
|
+
<p>普通弹窗使用配置的主题。</p>
|
|
24
|
+
</div>
|
|
25
|
+
</template>
|
|
26
|
+
</EbizTdesignButtonDialog>
|
|
27
|
+
|
|
28
|
+
<EbizTdesignButtonDialog
|
|
29
|
+
dialog-type="add"
|
|
30
|
+
button-text="添加数据"
|
|
31
|
+
title="添加数据"
|
|
32
|
+
dialog-width="500px"
|
|
33
|
+
confirm-text="确认添加"
|
|
34
|
+
cancel-text="取消"
|
|
35
|
+
button-theme="success"
|
|
36
|
+
button-icon="add"
|
|
37
|
+
:api-config="addApiConfig"
|
|
38
|
+
@api-success="handleAddSuccess"
|
|
39
|
+
@api-error="handleApiError"
|
|
40
|
+
>
|
|
41
|
+
<template #body>
|
|
42
|
+
<div class="dialog-content">
|
|
43
|
+
<p>这是一个添加数据弹窗示例。</p>
|
|
44
|
+
<p>添加数据弹窗主要用于添加新数据,使用绿色主题。</p>
|
|
45
|
+
<t-form ref="addForm">
|
|
46
|
+
<t-form-item label="名称">
|
|
47
|
+
<t-input v-model="formData.name" placeholder="请输入名称" />
|
|
48
|
+
</t-form-item>
|
|
49
|
+
<t-form-item label="描述">
|
|
50
|
+
<t-textarea v-model="formData.description" placeholder="请输入描述" />
|
|
51
|
+
</t-form-item>
|
|
52
|
+
</t-form>
|
|
53
|
+
</div>
|
|
54
|
+
</template>
|
|
55
|
+
</EbizTdesignButtonDialog>
|
|
56
|
+
|
|
57
|
+
<EbizTdesignButtonDialog
|
|
58
|
+
dialog-type="delete"
|
|
59
|
+
button-text="删除数据"
|
|
60
|
+
title="删除确认"
|
|
61
|
+
confirm-text="确认删除"
|
|
62
|
+
cancel-text="取消"
|
|
63
|
+
button-theme="danger"
|
|
64
|
+
button-icon="delete"
|
|
65
|
+
:api-config="deleteApiConfig"
|
|
66
|
+
@api-success="handleDeleteSuccess"
|
|
67
|
+
@api-error="handleApiError"
|
|
68
|
+
>
|
|
69
|
+
<template #body>
|
|
70
|
+
<div class="delete-confirm-content">
|
|
71
|
+
<t-icon name="error-circle" size="large" style="color: #e34d59; margin-right: 12px;" />
|
|
72
|
+
<p style="margin: 0; font-size: 14px;">确定要删除该数据吗?此操作不可逆,请谨慎操作。</p>
|
|
73
|
+
</div>
|
|
74
|
+
</template>
|
|
75
|
+
</EbizTdesignButtonDialog>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
|
|
79
|
+
<div class="example-section">
|
|
80
|
+
<t-switch v-model="visible" label="控制弹窗显示"></t-switch>
|
|
81
|
+
<h3>基础用法</h3>
|
|
82
|
+
<EbizTdesignButtonDialog
|
|
83
|
+
:visible="visible"
|
|
84
|
+
button-text="打开基础弹窗"
|
|
85
|
+
title="基础弹窗"
|
|
86
|
+
button-theme="primary"
|
|
87
|
+
dialog-width="500px"
|
|
88
|
+
confirm-text="确认"
|
|
89
|
+
cancel-text="取消"
|
|
90
|
+
@button-click="handleButtonClick"
|
|
91
|
+
@dialog-close="handleDialogClose"
|
|
92
|
+
@dialog-confirm="handleDialogConfirm"
|
|
93
|
+
@dialog-cancel="handleDialogCancel"
|
|
94
|
+
>
|
|
95
|
+
<template #body>
|
|
96
|
+
<div class="dialog-content">
|
|
97
|
+
这是一个基础的弹窗内容
|
|
98
|
+
</div>
|
|
99
|
+
</template>
|
|
100
|
+
</EbizTdesignButtonDialog>
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
<div class="example-section">
|
|
104
|
+
<h3>自定义按钮内容</h3>
|
|
105
|
+
<EbizTdesignButtonDialog
|
|
106
|
+
title="自定义按钮"
|
|
107
|
+
button-theme="success"
|
|
108
|
+
button-variant="outline"
|
|
109
|
+
dialog-width="500px"
|
|
110
|
+
confirm-text="确认"
|
|
111
|
+
cancel-text="取消"
|
|
112
|
+
>
|
|
113
|
+
<template #buttonContent>
|
|
114
|
+
<t-icon name="add" />
|
|
115
|
+
添加内容
|
|
116
|
+
</template>
|
|
117
|
+
<template #body>
|
|
118
|
+
<div class="dialog-content">
|
|
119
|
+
这是一个带有自定义按钮内容的弹窗
|
|
120
|
+
</div>
|
|
121
|
+
</template>
|
|
122
|
+
</EbizTdesignButtonDialog>
|
|
123
|
+
</div>
|
|
124
|
+
|
|
125
|
+
<div class="example-section">
|
|
126
|
+
<h3>自定义弹窗内容</h3>
|
|
127
|
+
<EbizTdesignButtonDialog
|
|
128
|
+
button-text="打开表单弹窗"
|
|
129
|
+
title="表单弹窗"
|
|
130
|
+
button-theme="warning"
|
|
131
|
+
button-size="large"
|
|
132
|
+
dialog-width="600px"
|
|
133
|
+
dialog-mode="modal"
|
|
134
|
+
dialog-placement="center"
|
|
135
|
+
confirm-text="提交"
|
|
136
|
+
cancel-text="取消"
|
|
137
|
+
>
|
|
138
|
+
<template #header>
|
|
139
|
+
<div class="custom-header">
|
|
140
|
+
<t-icon name="edit" />
|
|
141
|
+
自定义标题
|
|
142
|
+
</div>
|
|
143
|
+
</template>
|
|
144
|
+
<template #body>
|
|
145
|
+
<div class="dialog-content">
|
|
146
|
+
<t-form>
|
|
147
|
+
<t-form-item label="姓名">
|
|
148
|
+
<t-input placeholder="请输入姓名" />
|
|
149
|
+
</t-form-item>
|
|
150
|
+
<t-form-item label="年龄">
|
|
151
|
+
<t-input-number placeholder="请输入年龄" />
|
|
152
|
+
</t-form-item>
|
|
153
|
+
</t-form>
|
|
154
|
+
</div>
|
|
155
|
+
</template>
|
|
156
|
+
<template #footer>
|
|
157
|
+
<t-space>
|
|
158
|
+
<t-button theme="default" @click="handleDialogCancel">取消</t-button>
|
|
159
|
+
<t-button theme="primary" @click="handleDialogConfirm">提交</t-button>
|
|
160
|
+
</t-space>
|
|
161
|
+
</template>
|
|
162
|
+
</EbizTdesignButtonDialog>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<div class="example-section">
|
|
166
|
+
<h3>更多按钮样式</h3>
|
|
167
|
+
<div class="button-group">
|
|
168
|
+
<EbizTdesignButtonDialog
|
|
169
|
+
button-text="圆形按钮"
|
|
170
|
+
button-shape="circle"
|
|
171
|
+
button-theme="primary"
|
|
172
|
+
dialog-width="400px"
|
|
173
|
+
confirm-text="确认"
|
|
174
|
+
cancel-text="取消"
|
|
175
|
+
>
|
|
176
|
+
<template #body>圆形按钮示例</template>
|
|
177
|
+
</EbizTdesignButtonDialog>
|
|
178
|
+
|
|
179
|
+
<EbizTdesignButtonDialog
|
|
180
|
+
button-text="方形按钮"
|
|
181
|
+
button-shape="square"
|
|
182
|
+
button-theme="success"
|
|
183
|
+
dialog-width="400px"
|
|
184
|
+
confirm-text="确认"
|
|
185
|
+
cancel-text="取消"
|
|
186
|
+
>
|
|
187
|
+
<template #body>方形按钮示例</template>
|
|
188
|
+
</EbizTdesignButtonDialog>
|
|
189
|
+
|
|
190
|
+
<EbizTdesignButtonDialog
|
|
191
|
+
button-text="文字按钮"
|
|
192
|
+
button-variant="text"
|
|
193
|
+
button-theme="danger"
|
|
194
|
+
dialog-width="400px"
|
|
195
|
+
confirm-text="确认"
|
|
196
|
+
cancel-text="取消"
|
|
197
|
+
>
|
|
198
|
+
<template #body>文字按钮示例</template>
|
|
199
|
+
</EbizTdesignButtonDialog>
|
|
200
|
+
|
|
201
|
+
<EbizTdesignButtonDialog
|
|
202
|
+
button-icon="add"
|
|
203
|
+
button-text="带图标按钮"
|
|
204
|
+
button-theme="default"
|
|
205
|
+
dialog-width="400px"
|
|
206
|
+
confirm-text="确认"
|
|
207
|
+
cancel-text="取消"
|
|
208
|
+
>
|
|
209
|
+
<template #body>带图标按钮示例</template>
|
|
210
|
+
</EbizTdesignButtonDialog>
|
|
211
|
+
</div>
|
|
212
|
+
</div>
|
|
213
|
+
|
|
214
|
+
<div class="example-section">
|
|
215
|
+
<h3>API接口调用示例</h3>
|
|
216
|
+
<p>点击按钮后,弹窗确认时会调用接口,并根据接口结果触发对应事件</p>
|
|
217
|
+
|
|
218
|
+
<div class="button-group">
|
|
219
|
+
<EbizTdesignButtonDialog
|
|
220
|
+
button-text="提交数据"
|
|
221
|
+
button-theme="primary"
|
|
222
|
+
title="提交数据"
|
|
223
|
+
dialog-width="500px"
|
|
224
|
+
confirm-text="确认"
|
|
225
|
+
cancel-text="取消"
|
|
226
|
+
:api-config="successApiConfig"
|
|
227
|
+
@api-success="handleApiSuccess"
|
|
228
|
+
@api-error="handleApiError"
|
|
229
|
+
>
|
|
230
|
+
<template #body>
|
|
231
|
+
<div class="dialog-content">
|
|
232
|
+
<p>这个示例配置了一个成功的API调用。</p>
|
|
233
|
+
<p>点击确认按钮时,将提交以下数据:</p>
|
|
234
|
+
<t-code-block :code="JSON.stringify(successApiConfig, null, 2)" lang="json" />
|
|
235
|
+
<p>接口调用成功后会自动关闭弹窗并触发api-success事件。</p>
|
|
236
|
+
</div>
|
|
237
|
+
</template>
|
|
238
|
+
</EbizTdesignButtonDialog>
|
|
239
|
+
|
|
240
|
+
<EbizTdesignButtonDialog
|
|
241
|
+
button-text="错误请求"
|
|
242
|
+
button-theme="danger"
|
|
243
|
+
title="错误请求"
|
|
244
|
+
dialog-width="500px"
|
|
245
|
+
confirm-text="确认"
|
|
246
|
+
cancel-text="取消"
|
|
247
|
+
:api-config="errorApiConfig"
|
|
248
|
+
@api-success="handleApiSuccess"
|
|
249
|
+
@api-error="handleApiError"
|
|
250
|
+
>
|
|
251
|
+
<template #body>
|
|
252
|
+
<div class="dialog-content">
|
|
253
|
+
<p>这个示例配置了一个失败的API调用。</p>
|
|
254
|
+
<p>点击确认按钮时,将尝试请求:</p>
|
|
255
|
+
<t-code-block :code="JSON.stringify(errorApiConfig, null, 2)" lang="json" />
|
|
256
|
+
<p>接口调用失败后会显示错误消息并触发api-error事件。</p>
|
|
257
|
+
</div>
|
|
258
|
+
</template>
|
|
259
|
+
</EbizTdesignButtonDialog>
|
|
260
|
+
|
|
261
|
+
<EbizTdesignButtonDialog
|
|
262
|
+
button-text="自定义配置"
|
|
263
|
+
button-theme="success"
|
|
264
|
+
title="自定义API配置"
|
|
265
|
+
dialog-width="500px"
|
|
266
|
+
confirm-text="确认"
|
|
267
|
+
cancel-text="取消"
|
|
268
|
+
:api-config="successApiConfig"
|
|
269
|
+
:close-on-success="false"
|
|
270
|
+
:show-result-message="false"
|
|
271
|
+
@api-success="handleCustomApiSuccess"
|
|
272
|
+
>
|
|
273
|
+
<template #body>
|
|
274
|
+
<div class="dialog-content">
|
|
275
|
+
<p>这个示例配置了自定义的API行为。</p>
|
|
276
|
+
<p>设置了以下选项:</p>
|
|
277
|
+
<ul>
|
|
278
|
+
<li>关闭成功后自动关闭弹窗的选项</li>
|
|
279
|
+
<li>关闭显示结果消息的选项</li>
|
|
280
|
+
<li>自定义处理成功事件,显示自定义消息</li>
|
|
281
|
+
</ul>
|
|
282
|
+
<p v-if="apiResult">
|
|
283
|
+
<strong>API调用结果:</strong>
|
|
284
|
+
<t-tag theme="success">{{ apiResult }}</t-tag>
|
|
285
|
+
</p>
|
|
286
|
+
</div>
|
|
287
|
+
</template>
|
|
288
|
+
</EbizTdesignButtonDialog>
|
|
289
|
+
</div>
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
</template>
|
|
293
|
+
|
|
294
|
+
<script setup>
|
|
295
|
+
import { EbizTdesignButtonDialog } from '../index.js'
|
|
296
|
+
import { ref, reactive } from 'vue'
|
|
297
|
+
import {
|
|
298
|
+
Switch as TSwitch,
|
|
299
|
+
Form as TForm,
|
|
300
|
+
FormItem as TFormItem,
|
|
301
|
+
Input as TInput,
|
|
302
|
+
InputNumber as TInputNumber,
|
|
303
|
+
Space as TSpace,
|
|
304
|
+
Button as TButton,
|
|
305
|
+
Icon as TIcon,
|
|
306
|
+
Tag as TTag,
|
|
307
|
+
CodeBlock as TCodeBlock,
|
|
308
|
+
MessagePlugin,
|
|
309
|
+
Textarea as TTextarea
|
|
310
|
+
} from 'tdesign-vue-next'
|
|
311
|
+
|
|
312
|
+
const visible = ref(false)
|
|
313
|
+
const apiResult = ref(null)
|
|
314
|
+
|
|
315
|
+
// 表单数据
|
|
316
|
+
const formData = reactive({
|
|
317
|
+
name: '',
|
|
318
|
+
description: ''
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
// 添加数据API配置
|
|
322
|
+
const addApiConfig = {
|
|
323
|
+
url: '/api/items',
|
|
324
|
+
method: 'post',
|
|
325
|
+
data: formData
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// 删除数据API配置
|
|
329
|
+
const deleteApiConfig = {
|
|
330
|
+
url: '/api/items/123',
|
|
331
|
+
method: 'delete'
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// 模拟成功的API配置
|
|
335
|
+
const successApiConfig = {
|
|
336
|
+
url: '/api/success',
|
|
337
|
+
method: 'post',
|
|
338
|
+
data: {
|
|
339
|
+
name: '测试数据',
|
|
340
|
+
value: 100
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// 模拟失败的API配置
|
|
345
|
+
const errorApiConfig = {
|
|
346
|
+
url: '/api/error',
|
|
347
|
+
method: 'get'
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const handleButtonClick = (e) => {
|
|
351
|
+
console.log('按钮点击事件', e)
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
const handleDialogClose = (e) => {
|
|
355
|
+
console.log('弹窗关闭事件', e)
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const handleDialogConfirm = (e) => {
|
|
359
|
+
console.log('弹窗确认事件', e)
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const handleDialogCancel = (e) => {
|
|
363
|
+
console.log('弹窗取消事件', e)
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// API相关事件处理
|
|
367
|
+
const handleApiSuccess = (response) => {
|
|
368
|
+
console.log('API调用成功:', response)
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
const handleAddSuccess = (response) => {
|
|
372
|
+
console.log('添加数据成功:', response)
|
|
373
|
+
// 添加成功后清空表单
|
|
374
|
+
formData.name = ''
|
|
375
|
+
formData.description = ''
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const handleDeleteSuccess = (response) => {
|
|
379
|
+
console.log('删除数据成功:', response)
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const handleApiError = (error) => {
|
|
383
|
+
console.log('API调用失败:', error)
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
// 自定义API成功处理
|
|
387
|
+
const handleCustomApiSuccess = (response) => {
|
|
388
|
+
console.log('自定义API成功处理:', response)
|
|
389
|
+
apiResult.value = '接口调用成功!'
|
|
390
|
+
MessagePlugin.success({
|
|
391
|
+
content: '自定义成功消息:接口调用成功',
|
|
392
|
+
duration: 3000
|
|
393
|
+
})
|
|
394
|
+
}
|
|
395
|
+
</script>
|
|
396
|
+
|
|
397
|
+
<style scoped>
|
|
398
|
+
.example-container {
|
|
399
|
+
padding: 20px;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.example-section {
|
|
403
|
+
margin-bottom: 30px;
|
|
404
|
+
border-bottom: 1px solid #eee;
|
|
405
|
+
padding-bottom: 20px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.example-section h3 {
|
|
409
|
+
margin-bottom: 16px;
|
|
410
|
+
font-size: 16px;
|
|
411
|
+
color: #333;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.dialog-content {
|
|
415
|
+
padding: 20px;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
.custom-header {
|
|
419
|
+
display: flex;
|
|
420
|
+
align-items: center;
|
|
421
|
+
gap: 8px;
|
|
422
|
+
font-size: 16px;
|
|
423
|
+
font-weight: bold;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
.button-group {
|
|
427
|
+
display: flex;
|
|
428
|
+
gap: 16px;
|
|
429
|
+
flex-wrap: wrap;
|
|
430
|
+
margin-top: 16px;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.delete-confirm-content {
|
|
434
|
+
display: flex;
|
|
435
|
+
align-items: center;
|
|
436
|
+
padding: 16px;
|
|
437
|
+
}
|
|
438
438
|
</style>
|