@ebiz/designer-components 0.0.18 → 0.0.19

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.
Files changed (99) hide show
  1. package/package.json +3 -2
  2. package/src/apiService/mockDataService.js +116 -0
  3. package/src/apiService/simpleDataService.js +186 -80
  4. package/src/components/Button.vue +72 -22
  5. package/src/components/EbizAvatar.vue +116 -0
  6. package/src/components/EbizCheckbox.vue +94 -0
  7. package/src/components/EbizCheckboxGroup.vue +70 -0
  8. package/src/components/EbizDetailBlock.vue +82 -0
  9. package/src/components/EbizDialog.vue +244 -56
  10. package/src/components/EbizEmployeeInfo.vue +139 -0
  11. package/src/components/EbizFileUpload.vue +202 -0
  12. package/src/components/EbizPageHeader.vue +96 -0
  13. package/src/components/EbizPagination.vue +163 -0
  14. package/src/components/EbizRadio.vue +87 -0
  15. package/src/components/EbizRadioGroup.vue +84 -0
  16. package/src/components/EbizRemoteSelect.vue +118 -40
  17. package/src/components/EbizSpace.vue +101 -0
  18. package/src/components/EbizStatistic.vue +150 -0
  19. package/src/components/EbizSwiper.vue +114 -0
  20. package/src/components/EbizSwiperItem.vue +14 -0
  21. package/src/components/EbizSwitch.vue +86 -0
  22. package/src/components/EbizTabHeader.vue +145 -0
  23. package/src/components/EbizTabPanel.vue +23 -0
  24. package/src/components/EbizTable.vue +466 -0
  25. package/src/components/EbizTableColumn.vue +117 -0
  26. package/src/components/EbizTableSort.vue +181 -0
  27. package/src/components/EbizTabs.vue +133 -91
  28. package/src/components/EbizTimePicker.vue +144 -0
  29. package/src/components/EbizTitle.vue +3 -10
  30. package/src/components/EbizTree.vue +153 -0
  31. package/src/components/EbizTreeSelector.vue +423 -0
  32. package/src/components/Home.vue +8 -0
  33. package/src/components/TdesignAlert.vue +116 -0
  34. package/src/components/TdesignButton.vue +130 -0
  35. package/src/components/TdesignCalendar/index.vue +146 -0
  36. package/src/components/TdesignCard.vue +196 -0
  37. package/src/components/TdesignCol.vue +102 -0
  38. package/src/components/TdesignCollapse.vue +143 -0
  39. package/src/components/TdesignCollapsePanel.vue +80 -0
  40. package/src/components/TdesignDatePicker.vue +125 -0
  41. package/src/components/TdesignDialog.vue +226 -0
  42. package/src/components/TdesignForm.vue +134 -0
  43. package/src/components/TdesignFormItem.vue +106 -0
  44. package/src/components/TdesignGrid.vue +56 -0
  45. package/src/components/TdesignIcon.vue +68 -0
  46. package/src/components/TdesignImage.vue +163 -0
  47. package/src/components/TdesignImageViewer.vue +201 -0
  48. package/src/components/TdesignInput.vue +243 -0
  49. package/src/components/TdesignSelect.vue +445 -0
  50. package/src/components/TdesignTag.vue +118 -0
  51. package/src/components/TdesignTextarea.vue +143 -0
  52. package/src/components/TdesignTimeline.vue +58 -0
  53. package/src/components/TdesignTimelineItem.vue +72 -0
  54. package/src/components/TdesignUpload.vue +757 -0
  55. package/src/components/TdesignWatermark.vue +108 -0
  56. package/src/index.js +130 -0
  57. package/src/main.js +20 -4
  58. package/src/router/index.js +244 -5
  59. package/src/views/Button.vue +7 -3
  60. package/src/views/CheckboxDemo.vue +105 -0
  61. package/src/views/DialogDemo.vue +126 -0
  62. package/src/views/EbizAvatar.vue +224 -0
  63. package/src/views/EbizDetailBlockDemo.vue +31 -0
  64. package/src/views/EbizEmployeeInfo.vue +250 -0
  65. package/src/views/EbizRadioDemo.vue +152 -0
  66. package/src/views/EbizSpace.vue +186 -0
  67. package/src/views/EbizSwiper.vue +158 -0
  68. package/src/views/GridDemo.vue +239 -0
  69. package/src/views/Home.vue +63 -2
  70. package/src/views/PageHeaderDemo.vue +105 -0
  71. package/src/views/PaginationDemo.vue +97 -0
  72. package/src/views/RemoteSelect.vue +336 -5
  73. package/src/views/StatisticDemo.vue +191 -0
  74. package/src/views/SwitchDemo.vue +80 -0
  75. package/src/views/TableDemo.vue +335 -0
  76. package/src/views/TableSortDemo.vue +144 -0
  77. package/src/views/TableView.vue +69 -0
  78. package/src/views/TabsDemo.vue +283 -0
  79. package/src/views/TagDemo.vue +102 -0
  80. package/src/views/TdesignAlert.vue +99 -0
  81. package/src/views/TdesignButton.vue +191 -0
  82. package/src/views/TdesignCalendar.vue +95 -0
  83. package/src/views/TdesignCard.vue +297 -0
  84. package/src/views/TdesignCollapse.vue +294 -0
  85. package/src/views/TdesignDatePicker.vue +188 -0
  86. package/src/views/TdesignForm.vue +249 -0
  87. package/src/views/TdesignIcon.vue +204 -0
  88. package/src/views/TdesignImage.vue +216 -0
  89. package/src/views/TdesignImageViewer.vue +199 -0
  90. package/src/views/TdesignInput.vue +253 -0
  91. package/src/views/TdesignSelect.vue +474 -0
  92. package/src/views/TdesignSwiper.vue +158 -0
  93. package/src/views/TextareaDemo.vue +94 -0
  94. package/src/views/TimePickerDemo.vue +147 -0
  95. package/src/views/TimelineDemo.vue +161 -0
  96. package/src/views/TreeDemo.vue +255 -0
  97. package/src/views/TreeSelectorDemo.vue +246 -0
  98. package/src/views/UploadDemo.vue +122 -0
  99. package/src/views/WatermarkDemo.vue +86 -0
@@ -1,20 +1,351 @@
1
1
  <template>
2
- <div>
2
+ <div class="remote-select-demo-container">
3
3
  <ebiz-route-breadcrumb />
4
- <ebiz-remote-select />
4
+
5
+ <div class="demo-section">
6
+ <h3>基础用法</h3>
7
+ <p>基础的远程搜索选择器,支持远程数据加载</p>
8
+ <div class="demo-block">
9
+ <ebiz-remote-select
10
+ v-model="selectedValue"
11
+ :apiConfig="apiConfig"
12
+ @change="handleChange"
13
+ />
14
+ <div class="selected-value">当前选中值: {{ selectedValue || '暂无选择' }}</div>
15
+ </div>
16
+ </div>
17
+
18
+ <div class="demo-section">
19
+ <h3>多选模式</h3>
20
+ <p>设置 multiple 属性启用多选模式</p>
21
+ <div class="demo-block">
22
+ <ebiz-remote-select
23
+ v-model="multipleSelectedValue"
24
+ :apiConfig="apiConfig"
25
+ multiple
26
+ @change="handleMultipleChange"
27
+ />
28
+ <div class="selected-value">当前选中值: {{ multipleSelectedValue?.length ? multipleSelectedValue.join(', ') : '暂无选择' }}</div>
29
+ </div>
30
+ </div>
31
+
32
+ <div class="demo-section">
33
+ <h3>不同数据源</h3>
34
+ <p>可通过不同的API配置加载不同数据源</p>
35
+ <div class="demo-block">
36
+ <div class="data-source-row">
37
+ <span class="source-label">用户数据:</span>
38
+ <ebiz-remote-select
39
+ v-model="dataSourceValues.users"
40
+ :apiConfig="dataSourceConfigs.users"
41
+ placeholder="选择用户"
42
+ />
43
+ </div>
44
+ <div class="data-source-row">
45
+ <span class="source-label">产品数据:</span>
46
+ <ebiz-remote-select
47
+ v-model="dataSourceValues.products"
48
+ :apiConfig="dataSourceConfigs.products"
49
+ placeholder="选择产品"
50
+ />
51
+ </div>
52
+ <div class="data-source-row">
53
+ <span class="source-label">城市数据:</span>
54
+ <ebiz-remote-select
55
+ v-model="dataSourceValues.cities"
56
+ :apiConfig="dataSourceConfigs.cities"
57
+ placeholder="选择城市"
58
+ />
59
+ </div>
60
+ </div>
61
+ </div>
62
+
63
+ <div class="demo-section">
64
+ <h3>不同尺寸</h3>
65
+ <p>提供三种不同尺寸的选择器</p>
66
+ <div class="demo-block">
67
+ <div class="size-row">
68
+ <span class="size-label">小尺寸:</span>
69
+ <ebiz-remote-select
70
+ v-model="sizeValues.small"
71
+ :apiConfig="apiConfig"
72
+ size="small"
73
+ placeholder="小尺寸选择器"
74
+ />
75
+ </div>
76
+ <div class="size-row">
77
+ <span class="size-label">中尺寸:</span>
78
+ <ebiz-remote-select
79
+ v-model="sizeValues.medium"
80
+ :apiConfig="apiConfig"
81
+ size="medium"
82
+ placeholder="中尺寸选择器"
83
+ />
84
+ </div>
85
+ <div class="size-row">
86
+ <span class="size-label">大尺寸:</span>
87
+ <ebiz-remote-select
88
+ v-model="sizeValues.large"
89
+ :apiConfig="apiConfig"
90
+ size="large"
91
+ placeholder="大尺寸选择器"
92
+ />
93
+ </div>
94
+ </div>
95
+ </div>
96
+
97
+ <div class="demo-section">
98
+ <h3>禁用状态</h3>
99
+ <p>设置 disabled 属性禁用选择器</p>
100
+ <div class="demo-block">
101
+ <ebiz-remote-select
102
+ v-model="disabledValue"
103
+ :apiConfig="apiConfig"
104
+ disabled
105
+ placeholder="禁用状态"
106
+ />
107
+ </div>
108
+ </div>
109
+
110
+ <div class="demo-section">
111
+ <h3>带前缀图标</h3>
112
+ <p>通过 slot 自定义前缀图标</p>
113
+ <div class="demo-block">
114
+ <ebiz-remote-select
115
+ v-model="prefixIconValue"
116
+ :apiConfig="apiConfig"
117
+ placeholder="带前缀图标的选择器"
118
+ >
119
+ <template #prefix>
120
+ <t-icon name="search" />
121
+ </template>
122
+ </ebiz-remote-select>
123
+ </div>
124
+ </div>
125
+
126
+ <div class="demo-section">
127
+ <h3>自定义查询参数</h3>
128
+ <p>通过 queryParams 自定义查询参数</p>
129
+ <div class="demo-block">
130
+ <div class="query-params-control">
131
+ <t-input v-model="customQueryParam" placeholder="输入过滤条件" />
132
+ <t-button theme="primary" style="margin-left: 8px;" @click="updateQueryParams">应用过滤</t-button>
133
+ </div>
134
+ <ebiz-remote-select
135
+ v-model="queryParamsValue"
136
+ :apiConfig="apiConfig"
137
+ :queryParams="queryParams"
138
+ placeholder="带自定义查询参数的选择器"
139
+ />
140
+ </div>
141
+ </div>
142
+
143
+ <div class="demo-section">
144
+ <h3>API 参考</h3>
145
+ <t-table :data="propsData" :columns="propsColumns" bordered size="small" stripe />
146
+ <h4 style="margin-top: 16px;">事件</h4>
147
+ <t-table :data="eventsData" :columns="eventsColumns" bordered size="small" stripe />
148
+ <h4 style="margin-top: 16px;">插槽</h4>
149
+ <t-table :data="slotsData" :columns="slotsColumns" bordered size="small" stripe />
150
+ </div>
5
151
  </div>
6
152
  </template>
7
153
 
8
154
  <script>
155
+ import { defineComponent } from 'vue'
9
156
  import { EbizRemoteSelect } from '@/index.js'
157
+ import { Icon, Button, Input, Table } from 'tdesign-vue-next'
10
158
 
11
- export default {
159
+ // 替换实际的数据服务 - 用于演示
160
+ import dataServiceModule from '../apiService/simpleDataService'
161
+ // 备份原始fetch方法
162
+ dataServiceModule.fetch = dataServiceModule.fetch
163
+
164
+ export default defineComponent({
12
165
  name: 'RemoteSelectDemo',
13
166
  components: {
14
- EbizRemoteSelect
167
+ EbizRemoteSelect,
168
+ TIcon: Icon,
169
+ TButton: Button,
170
+ TInput: Input,
171
+ TTable: Table
172
+ },
173
+ data() {
174
+ return {
175
+ // 基础示例的选中值
176
+ selectedValue: '',
177
+
178
+ // 多选示例的选中值
179
+ multipleSelectedValue: [],
180
+
181
+ // 不同数据源示例的选中值
182
+ dataSourceValues: {
183
+ users: '',
184
+ products: '',
185
+ cities: ''
186
+ },
187
+
188
+ // 不同数据源配置
189
+ dataSourceConfigs: {
190
+ users: {
191
+ key: 'user_options',
192
+ apiId: 'mockUserList',
193
+ apiType: 'MULTIPLE_DATA_SEARCH'
194
+ },
195
+ products: {
196
+ key: 'product_options',
197
+ apiId: 'mockProductList',
198
+ apiType: 'MULTIPLE_DATA_SEARCH'
199
+ },
200
+ cities: {
201
+ key: 'city_options',
202
+ apiId: 'mockCityList',
203
+ apiType: 'MULTIPLE_DATA_SEARCH'
204
+ }
205
+ },
206
+
207
+ // 不同尺寸示例的选中值
208
+ sizeValues: {
209
+ small: '',
210
+ medium: '',
211
+ large: ''
212
+ },
213
+
214
+ // 禁用状态示例的选中值
215
+ disabledValue: '',
216
+
217
+ // 带前缀图标示例的选中值
218
+ prefixIconValue: '',
219
+
220
+ // 自定义查询参数示例
221
+ queryParamsValue: '',
222
+ customQueryParam: '',
223
+ queryParams: {},
224
+
225
+ // API配置
226
+ apiConfig: {
227
+ key: 'user_options',
228
+ apiId: 123,
229
+ apiType: 'MULTIPLE_DATA_SEARCH'
230
+ },
231
+
232
+ // API参考数据
233
+ propsColumns: [
234
+ { colKey: 'name', title: '属性名', width: '15%' },
235
+ { colKey: 'type', title: '类型', width: '15%' },
236
+ { colKey: 'default', title: '默认值', width: '15%' },
237
+ { colKey: 'desc', title: '说明' }
238
+ ],
239
+ propsData: [
240
+ { name: 'apiConfig', type: 'Object', default: '{}', desc: 'API配置,包含 key, apiId, apiType 属性' },
241
+ { name: 'queryParams', type: 'Object', default: '{}', desc: '查询参数,用于传递给后端API的查询条件' },
242
+ { name: 'multiple', type: 'Boolean', default: 'false', desc: '是否支持多选' },
243
+ { name: 'placeholder', type: 'String', default: '请选择', desc: '输入框占位文本' },
244
+ { name: 'clearable', type: 'Boolean', default: 'true', desc: '是否可以清空选项' },
245
+ { name: 'disabled', type: 'Boolean', default: 'false', desc: '是否禁用' },
246
+ { name: 'modelValue', type: 'String / Number / Array', default: "''", desc: '选择器选中值' },
247
+ { name: 'optionsConfig', type: 'Object', default: '{}', desc: '选项配置,包含 labelField, valueField 属性' },
248
+ { name: 'size', type: 'String', default: 'medium', desc: '组件尺寸,可选值为 small / medium / large' },
249
+ { name: 'emptyText', type: 'String', default: '暂无数据', desc: '空数据提示文本' },
250
+ { name: 'popupProps', type: 'Object', default: '{}', desc: '下拉弹出层的配置选项' }
251
+ ],
252
+
253
+ eventsColumns: [
254
+ { colKey: 'name', title: '事件名', width: '15%' },
255
+ { colKey: 'params', title: '参数', width: '25%' },
256
+ { colKey: 'desc', title: '说明' }
257
+ ],
258
+ eventsData: [
259
+ { name: 'update:modelValue', params: '(value: String / Number / Array)', desc: '选中值变化时触发,用于 v-model 双向绑定' },
260
+ { name: 'change', params: '(value: String / Number / Array, context: Object)', desc: '选中值发生变化时触发' },
261
+ { name: 'focus', params: '(value: String / Number / Array, context: Object)', desc: '获得焦点时触发' },
262
+ { name: 'blur', params: '(value: String / Number / Array, context: Object)', desc: '失去焦点时触发' }
263
+ ],
264
+
265
+ slotsColumns: [
266
+ { colKey: 'name', title: '插槽名', width: '15%' },
267
+ { colKey: 'desc', title: '说明' }
268
+ ],
269
+ slotsData: [
270
+ { name: 'prefix', desc: '自定义选择器前缀图标内容' },
271
+ { name: 'suffix', desc: '自定义选择器后缀图标内容' }
272
+ ]
273
+ }
274
+ },
275
+ methods: {
276
+ // 基础示例的选中值变化处理
277
+ handleChange(value) {
278
+ console.log('基础示例选中值变化:', value)
279
+ },
280
+
281
+ // 多选示例的选中值变化处理
282
+ handleMultipleChange(value) {
283
+ console.log('多选示例选中值变化:', value)
284
+ },
285
+
286
+ // 更新自定义查询参数
287
+ updateQueryParams() {
288
+ this.queryParams = {
289
+ keyword: this.customQueryParam
290
+ }
291
+ }
292
+ },
293
+ // 在组件卸载时恢复原始的fetch方法
294
+ unmounted() {
295
+ dataServiceModule.fetch = originalFetch
15
296
  }
16
- }
297
+ })
17
298
  </script>
18
299
 
19
300
  <style scoped>
301
+ .remote-select-demo-container {
302
+ padding: 20px;
303
+ }
304
+
305
+ .demo-section {
306
+ margin-bottom: 30px;
307
+ border-bottom: 1px solid #eee;
308
+ padding-bottom: 20px;
309
+ }
310
+
311
+ .demo-section h3 {
312
+ font-size: 18px;
313
+ font-weight: 600;
314
+ margin-bottom: 8px;
315
+ }
316
+
317
+ .demo-section p {
318
+ color: #666;
319
+ margin-bottom: 16px;
320
+ }
321
+
322
+ .demo-block {
323
+ background: #f9f9f9;
324
+ padding: 20px;
325
+ border-radius: 6px;
326
+ margin-top: 10px;
327
+ }
328
+
329
+ .selected-value {
330
+ margin-top: 10px;
331
+ font-size: 14px;
332
+ color: #666;
333
+ }
334
+
335
+ .size-row, .data-source-row {
336
+ display: flex;
337
+ align-items: center;
338
+ margin-bottom: 16px;
339
+ }
340
+
341
+ .size-label, .source-label {
342
+ width: 70px;
343
+ text-align: right;
344
+ margin-right: 8px;
345
+ }
346
+
347
+ .query-params-control {
348
+ display: flex;
349
+ margin-bottom: 16px;
350
+ }
20
351
  </style>
@@ -0,0 +1,191 @@
1
+ <template>
2
+ <div class="statistic-demo-container">
3
+ <h1>统计数值组件示例</h1>
4
+
5
+ <section>
6
+ <h2>基础用法</h2>
7
+ <div class="demo-row">
8
+ <ebiz-statistic
9
+ title="Total Assets"
10
+ :value="82.76"
11
+ :decimalPlaces="2"
12
+ unit="%"
13
+ />
14
+ </div>
15
+ </section>
16
+
17
+ <section>
18
+ <h2>趋势不同的组件</h2>
19
+ <div class="demo-row">
20
+ <ebiz-statistic
21
+ title="上升趋势"
22
+ :value="82.76"
23
+ :decimalPlaces="2"
24
+ unit="%"
25
+ trend="increase"
26
+ trendPlacement="left"
27
+ class="demo-item"
28
+ />
29
+
30
+ <ebiz-statistic
31
+ title="下降趋势"
32
+ :value="82.76"
33
+ :decimalPlaces="2"
34
+ unit="%"
35
+ trend="decrease"
36
+ trendPlacement="right"
37
+ class="demo-item"
38
+ />
39
+ </div>
40
+ </section>
41
+
42
+ <section>
43
+ <h2>颜色</h2>
44
+ <div class="demo-row">
45
+ <ebiz-statistic
46
+ title="默认颜色"
47
+ :value="82.76"
48
+ :decimalPlaces="2"
49
+ unit="%"
50
+ class="demo-item"
51
+ />
52
+
53
+ <ebiz-statistic
54
+ title="自定义颜色"
55
+ :value="82.76"
56
+ :decimalPlaces="2"
57
+ unit="%"
58
+ color="red"
59
+ class="demo-item"
60
+ />
61
+
62
+ <ebiz-statistic
63
+ title="自定义颜色"
64
+ :value="82.76"
65
+ :decimalPlaces="2"
66
+ unit="%"
67
+ color="green"
68
+ class="demo-item"
69
+ />
70
+ </div>
71
+ </section>
72
+
73
+ <section>
74
+ <h2>前缀后缀</h2>
75
+ <div class="demo-row">
76
+ <ebiz-statistic
77
+ title="带前缀"
78
+ :value="56.32"
79
+ :decimalPlaces="2"
80
+ unit="%"
81
+ prefix="$"
82
+ class="demo-item"
83
+ />
84
+
85
+ <ebiz-statistic
86
+ title="带后缀"
87
+ :value="176059"
88
+ suffix="元"
89
+ class="demo-item"
90
+ />
91
+ </div>
92
+ </section>
93
+
94
+ <section>
95
+ <h2>数值动画</h2>
96
+ <div class="demo-row">
97
+ <ebiz-statistic
98
+ ref="animationStatistic"
99
+ title="动画效果"
100
+ :value="82.76"
101
+ :decimalPlaces="2"
102
+ unit="%"
103
+ :animation="{ duration: 2000 }"
104
+ class="demo-item"
105
+ />
106
+
107
+ <button @click="startAnimation" class="demo-button">开始动画</button>
108
+ </div>
109
+ </section>
110
+
111
+ <section>
112
+ <h2>加载中</h2>
113
+ <div class="demo-row">
114
+ <ebiz-statistic
115
+ title="加载中状态"
116
+ :value="82.76"
117
+ :decimalPlaces="2"
118
+ unit="%"
119
+ :loading="true"
120
+ class="demo-item"
121
+ />
122
+ </div>
123
+ </section>
124
+ </div>
125
+ </template>
126
+
127
+ <script setup>
128
+ import { ref } from 'vue';
129
+ import { EbizStatistic } from '../index.js';
130
+
131
+ const animationStatistic = ref(null);
132
+
133
+ const startAnimation = () => {
134
+ if (animationStatistic.value) {
135
+ animationStatistic.value.start();
136
+ }
137
+ };
138
+ </script>
139
+
140
+ <style scoped>
141
+ .statistic-demo-container {
142
+ max-width: 1200px;
143
+ margin: 0 auto;
144
+ padding: 20px;
145
+ }
146
+
147
+ section {
148
+ margin-bottom: 40px;
149
+ }
150
+
151
+ h1 {
152
+ font-size: 24px;
153
+ margin-bottom: 24px;
154
+ }
155
+
156
+ h2 {
157
+ font-size: 20px;
158
+ margin-bottom: 16px;
159
+ border-bottom: 1px solid #eee;
160
+ padding-bottom: 8px;
161
+ }
162
+
163
+ .demo-row {
164
+ display: flex;
165
+ flex-wrap: wrap;
166
+ margin: 0 -12px;
167
+ }
168
+
169
+ .demo-item {
170
+ flex: 0 0 calc(33.33% - 24px);
171
+ margin: 0 12px 24px;
172
+ background-color: #f5f5f5;
173
+ padding: 16px;
174
+ border-radius: 4px;
175
+ min-width: 200px;
176
+ }
177
+
178
+ .demo-button {
179
+ margin-top: 20px;
180
+ padding: 8px 16px;
181
+ background-color: #0052d9;
182
+ color: white;
183
+ border: none;
184
+ border-radius: 4px;
185
+ cursor: pointer;
186
+ }
187
+
188
+ .demo-button:hover {
189
+ background-color: #003cab;
190
+ }
191
+ </style>
@@ -0,0 +1,80 @@
1
+ <template>
2
+ <div class="switch-demo">
3
+ <h1>TDesign Switch 组件示例</h1>
4
+
5
+ <h2>基础开关</h2>
6
+ <div class="demo-section">
7
+ <EbizSwitch v-model="checked1" />
8
+ <div class="status">当前状态: {{ checked1 ? '开' : '关' }}</div>
9
+ </div>
10
+
11
+ <h2>不同尺寸</h2>
12
+ <div class="demo-section">
13
+ <EbizSwitch v-model="checked2" size="small" />
14
+ <EbizSwitch v-model="checked2" size="medium" />
15
+ <EbizSwitch v-model="checked2" size="large" />
16
+ </div>
17
+
18
+ <h2>不同主题</h2>
19
+ <div class="demo-section">
20
+ <EbizSwitch v-model="checked3" theme="primary" />
21
+ <EbizSwitch v-model="checked3" theme="success" />
22
+ <EbizSwitch v-model="checked3" theme="warning" />
23
+ <EbizSwitch v-model="checked3" theme="danger" />
24
+ </div>
25
+
26
+ <h2>加载状态</h2>
27
+ <div class="demo-section">
28
+ <EbizSwitch v-model="checked4" loading />
29
+ </div>
30
+
31
+ <h2>禁用状态</h2>
32
+ <div class="demo-section">
33
+ <EbizSwitch v-model="checked5" disabled />
34
+ <EbizSwitch v-model="checked6" disabled />
35
+ </div>
36
+
37
+ <h2>带标签</h2>
38
+ <div class="demo-section">
39
+ <EbizSwitch v-model="checked7" :label="['开', '关']" />
40
+ </div>
41
+
42
+ <h2>自定义值</h2>
43
+ <div class="demo-section">
44
+ <EbizSwitch v-model="customChecked" :customValue="['开启', '关闭']" />
45
+ <div class="status">当前值: {{ customChecked }}</div>
46
+ </div>
47
+ </div>
48
+ </template>
49
+
50
+ <script setup>
51
+ import { ref } from 'vue';
52
+ import { EbizSwitch } from '../index.js';
53
+
54
+ const checked1 = ref(true);
55
+ const checked2 = ref(true);
56
+ const checked3 = ref(true);
57
+ const checked4 = ref(true);
58
+ const checked5 = ref(true);
59
+ const checked6 = ref(false);
60
+ const checked7 = ref(true);
61
+ const customChecked = ref('开启');
62
+ </script>
63
+
64
+ <style lang="less" scoped>
65
+ .switch-demo {
66
+ padding: 20px;
67
+
68
+ .demo-section {
69
+ margin-bottom: 20px;
70
+ display: flex;
71
+ align-items: center;
72
+ gap: 16px;
73
+ }
74
+
75
+ .status {
76
+ margin-left: 16px;
77
+ color: #666;
78
+ }
79
+ }
80
+ </style>