@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
@@ -0,0 +1,117 @@
1
+ <script setup>
2
+ import { computed, inject, onMounted, getCurrentInstance } from 'vue';
3
+
4
+ const props = defineProps({
5
+ // 列唯一标识
6
+ colKey: {
7
+ type: String,
8
+ required: true
9
+ },
10
+ // 列标题
11
+ title: {
12
+ type: String,
13
+ default: ''
14
+ },
15
+ // 列宽度
16
+ width: {
17
+ type: [String, Number],
18
+ default: ''
19
+ },
20
+ // 最小列宽
21
+ minWidth: {
22
+ type: [String, Number],
23
+ default: ''
24
+ },
25
+ // 水平对齐方式
26
+ align: {
27
+ type: String,
28
+ default: 'left',
29
+ validator: (val) => ['left', 'center', 'right'].includes(val)
30
+ },
31
+ // 固定列位置
32
+ fixed: {
33
+ type: String,
34
+ default: '',
35
+ validator: (val) => ['', 'left', 'right'].includes(val)
36
+ },
37
+ // 列类型
38
+ type: {
39
+ type: String,
40
+ default: '',
41
+ validator: (val) => ['', 'multiple', 'single', 'index', 'expand'].includes(val)
42
+ },
43
+ // 超出省略
44
+ ellipsis: {
45
+ type: Boolean,
46
+ default: false
47
+ },
48
+ // 标题超出省略
49
+ ellipsisTitle: {
50
+ type: Boolean,
51
+ default: false
52
+ },
53
+ // 是否支持排序
54
+ sorter: {
55
+ type: Boolean,
56
+ default: false
57
+ },
58
+ // 过滤配置
59
+ filter: {
60
+ type: Object,
61
+ default: null
62
+ },
63
+ // 自定义类名
64
+ className: {
65
+ type: String,
66
+ default: ''
67
+ },
68
+ // 是否禁用
69
+ disabled: {
70
+ type: Boolean,
71
+ default: false
72
+ }
73
+ });
74
+
75
+ // 获取父级表格组件实例
76
+ const tableCtx = inject('tableCtx', null);
77
+ const instance = getCurrentInstance();
78
+
79
+ // 格式化列配置对象
80
+ const columnConfig = computed(() => {
81
+ return {
82
+ colKey: props.colKey,
83
+ title: props.title,
84
+ width: props.width,
85
+ minWidth: props.minWidth,
86
+ align: props.align,
87
+ fixed: props.fixed || '',
88
+ type: props.type || '',
89
+ ellipsis: props.ellipsis,
90
+ ellipsisTitle: props.ellipsisTitle,
91
+ sorter: props.sorter,
92
+ filter: props.filter,
93
+ className: props.className,
94
+ disabled: props.disabled,
95
+ cell: instance.slots.default ? props.colKey : undefined,
96
+ title: instance.slots.title ? `title-${props.colKey}` : undefined
97
+ };
98
+ });
99
+
100
+ // 在组件挂载时将列配置注册到表格组件
101
+ onMounted(() => {
102
+ if (tableCtx && typeof tableCtx.registerColumn === 'function') {
103
+ tableCtx.registerColumn(columnConfig.value);
104
+ } else {
105
+ console.warn('EbizTableColumn必须在EbizTable内部使用');
106
+ }
107
+ });
108
+ </script>
109
+
110
+ <template>
111
+ <template v-if="$slots.default">
112
+ <slot></slot>
113
+ </template>
114
+ <template v-if="$slots.title">
115
+ <slot name="title"></slot>
116
+ </template>
117
+ </template>
@@ -0,0 +1,181 @@
1
+ <template>
2
+ <div class="ebiz-table-sort">
3
+ <t-popup :visible="sortVisible" trigger="click" placement="bottom-right" :overlay-style="{ width: '450px' }"
4
+ @visible-change="handleVisibleChange" :destroy-on-close="false">
5
+ <template #content>
6
+ <t-card :title="popupTitle" size="small" :bordered="false">
7
+ <div class="sort-content">
8
+ <div class="sort-item" v-for="(item, index) in sortItems" :key="index">
9
+ <div class="sort-item-content" style="display: flex; margin-bottom: 12px;">
10
+ <t-select v-model="item.type" :placeholder="fieldPlaceholder" :options="fieldOptions" :clearable="false"
11
+ :style="{ width: '170px' }" @change="handleSortChange" />
12
+ <t-select v-model="item.sort" :placeholder="orderPlaceholder" :options="orderOptions" :clearable="false"
13
+ :style="{ width: '170px', marginLeft: '8px' }" @change="handleSortChange" />
14
+ <t-button theme="default" variant="text" shape="circle" @click="removeSortItem(index)"
15
+ v-if="sortItems.length > 1" :style="{ marginLeft: '8px', flexShrink: 0 }">
16
+ <template #icon>
17
+ <t-icon name="close" />
18
+ </template>
19
+ </t-button>
20
+ </div>
21
+ </div>
22
+ <div class="sort-footer">
23
+ <t-button theme="default" variant="outline" @click="addSortItem"
24
+ v-if="sortItems.length < maxSortItems">
25
+ <template #icon>
26
+ <t-icon name="add" />
27
+ </template>
28
+ {{ addConditionText }}
29
+ </t-button>
30
+ </div>
31
+ </div>
32
+ </t-card>
33
+ </template>
34
+ <t-button block variant="outline" :title="title">
35
+ <template #icon>
36
+ <t-icon :name="icon" />
37
+ </template>
38
+ <div v-if="buttonText">
39
+ {{ buttonText }}
40
+ </div>
41
+ </t-button>
42
+ </t-popup>
43
+ </div>
44
+ </template>
45
+
46
+ <script>
47
+ export default {
48
+ name: "EbizTableSort"
49
+ }
50
+ </script>
51
+
52
+ <script setup>
53
+ import { ref, computed, defineProps, defineEmits, watch } from 'vue';
54
+ import { Button as TButton, Popup as TPopup, Card as TCard, Select as TSelect, Icon as TIcon } from 'tdesign-vue-next';
55
+
56
+ const props = defineProps({
57
+ // v-model绑定值
58
+ modelValue: {
59
+ type: Array,
60
+ default: () => []
61
+ },
62
+ // 按钮图标
63
+ icon: {
64
+ type: String,
65
+ default: 'sort'
66
+ },
67
+ // 按钮文本
68
+ buttonText: {
69
+ type: String,
70
+ default: ''
71
+ },
72
+ // 按钮标题
73
+ title: {
74
+ type: String,
75
+ default: '排序'
76
+ },
77
+ // 弹出层标题
78
+ popupTitle: {
79
+ type: String,
80
+ default: '排序'
81
+ },
82
+ // 字段选项
83
+ fieldOptions: {
84
+ type: Array,
85
+ default: () => []
86
+ },
87
+ // 字段占位符
88
+ fieldPlaceholder: {
89
+ type: String,
90
+ default: '选择字段'
91
+ },
92
+ // 排序选项
93
+ orderOptions: {
94
+ type: Array,
95
+ default: () => [
96
+ { value: 'asc', label: '升序 ↑' },
97
+ { value: 'desc', label: '降序 ↓' }
98
+ ]
99
+ },
100
+ // 排序占位符
101
+ orderPlaceholder: {
102
+ type: String,
103
+ default: '选择排序'
104
+ },
105
+ // 最大排序条件数量
106
+ maxSortItems: {
107
+ type: Number,
108
+ default: 5
109
+ },
110
+ // 添加条件文本
111
+ addConditionText: {
112
+ type: String,
113
+ default: '添加排序条件'
114
+ }
115
+ });
116
+
117
+ const emit = defineEmits(['update:modelValue', 'sort', 'visible-change']);
118
+
119
+ // 排序弹出层显示状态
120
+ const sortVisible = ref(false);
121
+
122
+ // 排序条件列表
123
+ const sortItems = ref([]);
124
+
125
+ // 监听modelValue变化
126
+ watch(() => props.modelValue, (newVal) => {
127
+ if (newVal && newVal.length > 0) {
128
+ sortItems.value = JSON.parse(JSON.stringify(newVal));
129
+ } else {
130
+ // 默认添加一个空的排序条件
131
+ sortItems.value = [{ type: '', sort: 'desc' }];
132
+ }
133
+ }, { immediate: true });
134
+
135
+ // 添加排序条件
136
+ const addSortItem = () => {
137
+ if (sortItems.value.length < props.maxSortItems) {
138
+ sortItems.value.push({ type: '', sort: 'desc' });
139
+ }
140
+ };
141
+
142
+ // 移除排序条件
143
+ const removeSortItem = (index) => {
144
+ sortItems.value.splice(index, 1);
145
+ handleSortChange();
146
+ };
147
+
148
+ // 处理排序变更
149
+ const handleSortChange = () => {
150
+ // 过滤有效的排序条件(字段和排序方向都不为空)
151
+ const validSortItems = sortItems.value.filter(item => item.type && item.sort);
152
+ emit('update:modelValue', validSortItems);
153
+ emit('sort', validSortItems);
154
+ };
155
+
156
+ // 弹出层可见性变化
157
+ const handleVisibleChange = (visible) => {
158
+ sortVisible.value = visible;
159
+ emit('visible-change', visible);
160
+ };
161
+ </script>
162
+
163
+ <style lang="less" scoped>
164
+ .ebiz-table-sort {
165
+ display: inline-block;
166
+
167
+ .sort-content {
168
+ min-width: 400px;
169
+ width: 100%;
170
+ }
171
+
172
+ .sort-footer {
173
+ margin-top: 16px;
174
+ }
175
+
176
+ .sort-actions {
177
+ display: flex;
178
+ justify-content: flex-end;
179
+ }
180
+ }
181
+ </style>
@@ -1,101 +1,143 @@
1
1
  <template>
2
- <tiny-tabs v-model="showTab" :tab-style="props.tabStyle" activeColor="#5e7ce0" @click="tabChange">
3
- <tiny-tab-item activeColor="#5e7ce0" v-for="i in showTabs" :key="i.value" :title="i.label" :name="i.value.toString()">
2
+ <div class="tdesign-tabs-wrapper">
3
+ <t-tabs
4
+ v-model="innerValue"
5
+ :addable="addable"
6
+ :disabled="disabled"
7
+ :placement="placement"
8
+ :size="size"
9
+ :theme="theme"
10
+ :list="list"
11
+ :dragSort="dragSort"
12
+ @add="handleAdd"
13
+ @change="handleChange"
14
+ @dragSort="handleDragSort"
15
+ @remove="handleRemove"
16
+ >
17
+ <!-- 添加按钮插槽 -->
18
+ <template v-if="$slots.action" #action>
19
+ <slot name="action"></slot>
20
+ </template>
21
+
22
+ <!-- 直接输出默认插槽内容,这里应该只包含EbizTabPanel -->
4
23
  <slot></slot>
5
- </tiny-tab-item>
6
- </tiny-tabs>
24
+ </t-tabs>
25
+ </div>
7
26
  </template>
8
27
 
9
- <script setup lang="jsx">
10
- import { ref,computed,watch} from 'vue'
11
- import { TinyTabs, TinyTabItem } from '@opentiny/vue'
12
- import {dataService} from "../index.js";
13
- const emit = defineEmits(['tabChange'])
14
- const props = defineProps({
15
- // 远程请求的配置
16
- apiConfig: {
17
- type: Object,
18
- default:()=>({
19
- apiId: null,
20
- apiType: 'MULTIPLE_DATA_SEARCH',
21
- }),
22
- },
23
- // 不使用用远程的tabs
24
- tabs:{
25
- type:Array,
26
- default:()=>[],
27
- },
28
- // tab名称对应的字段
29
- labelKey:{
30
- type:String,
31
- default:'name'
32
- },
33
- // tab value对应的字段
34
- valueKey:{
35
- type:String,
36
- default:'id'
37
- },
38
- // 标签卡样式
39
- tabStyle:{
40
- type:String,
41
- default:''
42
- },
43
- // 展示值
44
- showTab:{
45
- type:String,
46
- default:''
28
+ <script>
29
+ import { Tabs as TTabs } from 'tdesign-vue-next';
30
+ import { defineComponent, toRefs, computed, watch } from 'vue';
31
+
32
+ export default defineComponent({
33
+ name: 'EbizTabs',
34
+ components: {
35
+ 't-tabs': TTabs,
47
36
  },
48
- // 绑定值
49
- currentTab:{
50
- type:String,
51
- default:''
37
+ props: {
38
+ // v-model绑定值
39
+ modelValue: {
40
+ type: [String, Number],
41
+ },
42
+ // 默认值
43
+ defaultValue: {
44
+ type: [String, Number],
45
+ },
46
+ // 选项卡右侧的操作区域
47
+ action: {
48
+ type: [Function, String],
49
+ default: undefined
50
+ },
51
+ // 选项卡是否可增加
52
+ addable: {
53
+ type: Boolean,
54
+ default: false
55
+ },
56
+ // 是否禁用选项卡
57
+ disabled: {
58
+ type: Boolean,
59
+ default: false
60
+ },
61
+ // 是否开启拖拽调整顺序
62
+ dragSort: {
63
+ type: Boolean,
64
+ default: false
65
+ },
66
+ // 选项卡列表
67
+ list: {
68
+ type: Array,
69
+ },
70
+ // 选项卡位置
71
+ placement: {
72
+ type: String,
73
+ default: 'top',
74
+ validator: (val) => ['top', 'bottom', 'left', 'right'].includes(val)
75
+ },
76
+ // 组件尺寸
77
+ size: {
78
+ type: String,
79
+ default: 'medium',
80
+ validator: (val) => ['medium', 'large'].includes(val)
81
+ },
82
+ // 选项卡风格
83
+ theme: {
84
+ type: String,
85
+ default: 'normal',
86
+ validator: (val) => ['normal', 'card'].includes(val)
87
+ }
52
88
  },
53
- })
54
- // 远程请求的tabs
55
- const remoteTabs = ref([]);
56
- // 展示的tabs
57
- const showTabs = computed(()=>{
58
- if(remoteTabs.value.length) return [{label:'全部',value:'0'},...remoteTabs.value];
59
- if(props.tabs.length) return props.tabs;
60
- return [{label:'全部',value:'0'}];
61
- })
62
-
63
- // 展示的值
64
- const showTab = computed(()=>{
65
- if(props.showTab) return props.showTab;
66
- return props.currentTab || '0';
67
- })
68
- // methods
69
- const tabChange= (e)=>{
70
- emit('tabChange',e.name === '0'?'':e.name);
71
- }
72
- // init
73
- watch(()=>showTabs.value,()=>{
74
- tabChange({name:showTab.value})
75
- })
76
- watch(()=>props.apiConfig,(nVal) => {
77
- if(!nVal?.apiId) return;
78
- dataService.fetch({ }, {apiId:nVal.apiId,apiType:'MULTIPLE_DATA_SEARCH'}).then(res => {
79
- remoteTabs.value = (res.data ?? []).map(i=>({
80
- label:i[props.labelKey],
81
- value:i[props.valueKey],
82
- }))
83
- })
84
- },{immediate:true})
89
+ emits: ['update:modelValue', 'add', 'change', 'dragSort', 'remove'],
90
+ setup(props, { emit }) {
91
+ const { modelValue, defaultValue } = toRefs(props);
92
+
93
+ // 内部值计算属性,用于双向绑定
94
+ const innerValue = computed({
95
+ get: () => modelValue.value !== undefined ? modelValue.value : defaultValue.value,
96
+ set: (val) => {
97
+ emit('update:modelValue', val);
98
+ }
99
+ });
100
+
101
+ // 监听modelValue变化
102
+ watch(modelValue, (newVal) => {
103
+ if (newVal !== innerValue.value) {
104
+ innerValue.value = newVal;
105
+ }
106
+ });
107
+
108
+ // 添加选项卡事件
109
+ const handleAdd = (context) => {
110
+ emit('add', context);
111
+ };
112
+
113
+ // 选项卡切换事件
114
+ const handleChange = (value, context) => {
115
+ emit('change', value, context);
116
+ };
117
+
118
+ // 拖拽排序事件
119
+ const handleDragSort = (context) => {
120
+ emit('dragSort', context);
121
+ };
122
+
123
+ // 删除选项卡事件
124
+ const handleRemove = (options) => {
125
+ emit('remove', options);
126
+ };
127
+
128
+ return {
129
+ innerValue,
130
+ handleAdd,
131
+ handleChange,
132
+ handleDragSort,
133
+ handleRemove
134
+ };
135
+ }
136
+ });
85
137
  </script>
86
138
 
87
- <style scoped>
88
- .pc-demo .tiny-tabs__content {
89
- line-height: 2;
90
- }
91
- </style>
92
-
93
- <style scoped lang="less">
94
- :deep(.tiny-tabs__item.is-active){
95
- color:#5e7ce0;
96
- }
97
- :deep(.tiny-tabs__active-bar){
98
- background:#5e7ce0;
99
- height:4px;
139
+ <style lang="less" scoped>
140
+ .tdesign-tabs-wrapper {
141
+ width: 100%;
100
142
  }
101
143
  </style>
@@ -0,0 +1,144 @@
1
+ <template>
2
+ <t-time-picker
3
+ v-bind="$attrs"
4
+ :value="modelValue"
5
+ :allow-input="allowInput"
6
+ :clearable="clearable"
7
+ :disabled="disabled"
8
+ :disable-time="disableTime"
9
+ :format="format"
10
+ :input-props="inputProps"
11
+ :placeholder="placeholder"
12
+ :popup-props="popupProps"
13
+ :size="size"
14
+ :steps="steps"
15
+ :range="range"
16
+ :range-separator="rangeSeparator"
17
+ :tips="tips"
18
+ @change="handleChange"
19
+ @blur="$emit('blur', $event)"
20
+ @focus="$emit('focus', $event)"
21
+ @close="$emit('close', $event)"
22
+ @open="$emit('open', $event)"
23
+ @dayclick="$emit('dayclick', $event)"
24
+ @pick="$emit('pick', $event)"
25
+ >
26
+ <template v-if="$slots.suffixIcon" #suffixIcon>
27
+ <slot name="suffixIcon"></slot>
28
+ </template>
29
+ <template v-if="$slots.panel" #panel="slotProps">
30
+ <slot name="panel" v-bind="slotProps"></slot>
31
+ </template>
32
+ <template v-if="$slots.prepend" #prepend>
33
+ <slot name="prepend"></slot>
34
+ </template>
35
+ <template v-if="$slots.tips" #tips>
36
+ <slot name="tips"></slot>
37
+ </template>
38
+ </t-time-picker>
39
+ </template>
40
+
41
+ <script setup>
42
+ import { TimePicker as TTimePicker } from 'tdesign-vue-next';
43
+ import { computed } from 'vue';
44
+
45
+ const props = defineProps({
46
+ // 选中值
47
+ modelValue: {
48
+ type: [String, Array],
49
+ default: '',
50
+ },
51
+ // 是否允许直接输入时间
52
+ allowInput: {
53
+ type: Boolean,
54
+ default: true,
55
+ },
56
+ // 是否允许清除选中值
57
+ clearable: {
58
+ type: Boolean,
59
+ default: true,
60
+ },
61
+ // 是否禁用组件
62
+ disabled: {
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ // 禁用时间项
67
+ disableTime: {
68
+ type: Function,
69
+ default: null,
70
+ },
71
+ // 时间格式
72
+ format: {
73
+ type: String,
74
+ default: 'HH:mm:ss',
75
+ },
76
+ // 透传给输入框的属性
77
+ inputProps: {
78
+ type: Object,
79
+ default: () => ({}),
80
+ },
81
+ // 输入框占位文本
82
+ placeholder: {
83
+ type: String,
84
+ default: '请选择时间',
85
+ },
86
+ // 透传给 popup 组件的属性
87
+ popupProps: {
88
+ type: Object,
89
+ default: () => ({}),
90
+ },
91
+ // 尺寸
92
+ size: {
93
+ type: String,
94
+ default: 'medium',
95
+ validator(val) {
96
+ return ['small', 'medium', 'large'].includes(val);
97
+ },
98
+ },
99
+ // 时间间隔步数
100
+ steps: {
101
+ type: Array,
102
+ default: () => [1, 1, 1],
103
+ },
104
+ // 是否为时间范围选择
105
+ range: {
106
+ type: Boolean,
107
+ default: false,
108
+ },
109
+ // 范围分隔符
110
+ rangeSeparator: {
111
+ type: String,
112
+ default: ' - ',
113
+ },
114
+ // 提示文本
115
+ tips: {
116
+ type: [String, Function],
117
+ default: '',
118
+ },
119
+ });
120
+
121
+ const emit = defineEmits([
122
+ 'update:modelValue',
123
+ 'change',
124
+ 'blur',
125
+ 'focus',
126
+ 'close',
127
+ 'open',
128
+ 'dayclick',
129
+ 'pick',
130
+ ]);
131
+
132
+ // 处理值变更事件
133
+ const handleChange = (value) => {
134
+ emit('update:modelValue', value);
135
+ emit('change', value);
136
+ };
137
+
138
+ </script>
139
+
140
+ <style>
141
+ .t-time-picker {
142
+ width: 100%;
143
+ }
144
+ </style>