v-uni-app-ui 1.0.4 → 1.0.7

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 (89) hide show
  1. package/README.md +62 -82
  2. package/dist/v-uni-app-ui.css +1 -0
  3. package/dist/v-uni-app-ui.es.js +6569 -0
  4. package/dist/v-uni-app-ui.umd.js +7 -0
  5. package/package.json +17 -5
  6. package/components/config/css/basic.scss +0 -19
  7. package/components/config/interface/basic-type.js +0 -16
  8. package/components/config/interface/components-interface.ts +0 -0
  9. package/components/config/interface/monitor/components/input-monitor.js +0 -0
  10. package/components/config/interface/monitor/property-monitor.ts +0 -136
  11. package/components/config/interface/props/basic-props.ts +0 -88
  12. package/components/config/interface/props/components/button-props.ts +0 -85
  13. package/components/config/interface/props/components/input-props.ts +0 -69
  14. package/components/config/interface/props/props-tools.ts +0 -64
  15. package/components/config/style/basic.js +0 -346
  16. package/components/config/style/component-registry.js +0 -142
  17. package/components/config/style/components/button-style.js +0 -160
  18. package/components/config/style/components/input-style.js +0 -98
  19. package/components/config/style/components-style.js +0 -622
  20. package/components/config/style/property-mapper.js +0 -377
  21. package/components/config/style/pseudo-processor.js +0 -213
  22. package/components/config.js +0 -123
  23. package/components/icon/iconfont.css +0 -87
  24. package/components/icon/iconfont.js +0 -1
  25. package/components/icon/iconfont.json +0 -135
  26. package/components/icon/iconfont.ttf +0 -0
  27. package/components/icon/iconfont.woff +0 -0
  28. package/components/icon/iconfont.woff2 +0 -0
  29. package/components/layout/v-card/v-card.vue +0 -108
  30. package/components/layout/v-grid/v-grid.vue +0 -162
  31. package/components/layout/v-icon-grid/v-icon-grid.vue +0 -195
  32. package/components/layout/v-infinite-scroll/v-infinite-scroll.vue +0 -172
  33. package/components/layout/v-list/v-list.vue +0 -43
  34. package/components/layout/v-row/v-row.vue +0 -142
  35. package/components/layout/v-waterfall/v-waterfall.vue +0 -79
  36. package/components/model/compound/v-checkbox-group/v-checkbox-group.vue +0 -96
  37. package/components/model/compound/v-console/v-console.js +0 -20
  38. package/components/model/compound/v-console/v-console.vue +0 -299
  39. package/components/model/compound/v-date-time/v-date-time.vue +0 -261
  40. package/components/model/compound/v-dialog/v-dialog.vue +0 -178
  41. package/components/model/compound/v-drum-select-picker/v-drum-select-picker.vue +0 -83
  42. package/components/model/compound/v-form/v-form.vue +0 -226
  43. package/components/model/compound/v-form-item/v-form-item.vue +0 -255
  44. package/components/model/compound/v-image/v-image.vue +0 -357
  45. package/components/model/compound/v-input-desensitize/v-input-desensitize.vue +0 -101
  46. package/components/model/compound/v-page/v-page.vue +0 -11
  47. package/components/model/compound/v-pages/v-pages.vue +0 -141
  48. package/components/model/compound/v-picker-list/v-picker-list.vue +0 -109
  49. package/components/model/compound/v-popup/v-popup.vue +0 -151
  50. package/components/model/compound/v-radio-group/v-radio-group.vue +0 -86
  51. package/components/model/compound/v-select-picker/v-select-picker.vue +0 -202
  52. package/components/model/compound/v-series-picker-list/v-series-picker-list.vue +0 -221
  53. package/components/model/compound/v-series-select-picker/v-series-select-picker.vue +0 -203
  54. package/components/model/compound/v-switch/v-switch.vue +0 -136
  55. package/components/model/compound/v-tabs-page/v-tabs-page.vue +0 -138
  56. package/components/model/native/v-badge/v-badge.vue +0 -143
  57. package/components/model/native/v-button/v-button.vue +0 -81
  58. package/components/model/native/v-carousel/v-carousel.vue +0 -138
  59. package/components/model/native/v-checkbox/v-checkbox.vue +0 -215
  60. package/components/model/native/v-collapse/v-collapse.vue +0 -190
  61. package/components/model/native/v-header-navigation-bar/v-header-navigation-bar.vue +0 -92
  62. package/components/model/native/v-input/v-input.vue +0 -163
  63. package/components/model/native/v-input-code/v-input-code.vue +0 -146
  64. package/components/model/native/v-loading/v-loading.vue +0 -206
  65. package/components/model/native/v-menu/v-menu.vue +0 -222
  66. package/components/model/native/v-menu-slide/v-menu-slide.vue +0 -364
  67. package/components/model/native/v-min-loading/v-min-loading.vue +0 -80
  68. package/components/model/native/v-null/v-null.vue +0 -97
  69. package/components/model/native/v-overlay/v-overlay.vue +0 -96
  70. package/components/model/native/v-pull-up-refresh/v-pull-up-refresh.vue +0 -157
  71. package/components/model/native/v-radio/v-radio.vue +0 -138
  72. package/components/model/native/v-scroll-list/v-scroll-list.vue +0 -169
  73. package/components/model/native/v-steps/v-steps.vue +0 -253
  74. package/components/model/native/v-table/v-table.vue +0 -203
  75. package/components/model/native/v-tabs/v-tabs.vue +0 -235
  76. package/components/model/native/v-tag/v-tag.vue +0 -206
  77. package/components/model/native/v-text/v-text.vue +0 -187
  78. package/components/model/native/v-textarea/v-textarea.vue +0 -178
  79. package/components/model/native/v-title/v-title.vue +0 -91
  80. package/components/model/native/v-toast/info.png +0 -0
  81. package/components/model/native/v-toast/success.png +0 -0
  82. package/components/model/native/v-toast/v-toast.vue +0 -198
  83. package/components/model/native/v-toast/warn.png +0 -0
  84. package/components/model/native/v-upload-file-button/v-upload-file-button.vue +0 -296
  85. package/components/model/native/v-video/v-video.vue +0 -175
  86. package/components/model/native/v-window/v-window.vue +0 -158
  87. package/components/utils/event-modifiers.ts +0 -139
  88. package/components/utils/validator.ts +0 -451
  89. package/index.js +0 -372
@@ -1,96 +0,0 @@
1
- <template>
2
- <view :class="['v-checkbox-group', vertical ? 'vertical' : 'horizontal']" :style="groupStyle" role="checkboxgroup">
3
- <slot />
4
- </view>
5
- </template>
6
-
7
- <script lang="ts" setup>
8
- import { provide, computed, ref, watch } from 'vue';
9
-
10
- /**
11
- * v-checkbox-group 复选按钮组
12
- * value 双向绑定
13
- * vertical 布局方向 默认值:false 可选值:true竖 false:行
14
- * disabled 是否禁用 默认值:false 可选值:false不禁用 true禁用
15
- * indeterminate 是否开启全选/半选功能 默认值:false 可选值:false不开启 true开启
16
- * groupStyle 自定义样式
17
- * 相关事件:change
18
- */
19
- const props = defineProps({
20
- value: {
21
- type: Array as () => Array<string | number | object>,
22
- default: () => []
23
- },
24
- vertical: {
25
- type: Boolean,
26
- default: false
27
- },
28
- disabled: {
29
- type: Boolean,
30
- default: false
31
- },
32
- indeterminate: {
33
- type: Boolean,
34
- default: false
35
- },
36
- groupStyle: {
37
- type: Object,
38
- default: () => ({})
39
- }
40
- });
41
-
42
- const emit = defineEmits(['update:value', 'change']);
43
-
44
- const checkedValues = ref([...props.value]);
45
-
46
- provide('checkboxGroup', {
47
- name: 'vCheckboxGroup',
48
- checkedValues,
49
- disabled: computed(() => props.disabled),
50
- indeterminate: computed(() => props.indeterminate)
51
- });
52
-
53
- watch(
54
- () => props.value,
55
- (newVal) => {
56
- checkedValues.value = [...newVal];
57
- }
58
- );
59
-
60
- const updateValues = (newValues: any[]) => {
61
- checkedValues.value = newValues;
62
- emit('update:value', newValues);
63
- emit('change', newValues);
64
- };
65
-
66
- defineExpose({
67
- updateValues
68
- });
69
- </script>
70
-
71
- <style lang="scss">
72
- .v-checkbox-group {
73
- &.horizontal {
74
- display: flex;
75
- flex-wrap: wrap;
76
-
77
- .v-checkbox {
78
- margin-right: 32rpx;
79
-
80
- &:last-child {
81
- margin-right: 0;
82
- }
83
- }
84
- }
85
-
86
- &.vertical {
87
- .v-checkbox {
88
- margin-bottom: 24rpx;
89
-
90
- &:last-child {
91
- margin-bottom: 0;
92
- }
93
- }
94
- }
95
- }
96
- </style>
@@ -1,20 +0,0 @@
1
- export function initVConsole() {
2
- const STORAGE_KEY = 'v-console-logs';
3
- const logs = [];
4
-
5
- ['log', 'info', 'warn', 'error', 'debug'].forEach((type) => {
6
- const original = console[type];
7
- console[type] = (...args) => {
8
- original.apply(console, args);
9
- const time = new Date().toLocaleTimeString();
10
- const msg = args.map((v) => (typeof v === 'object' ? JSON.stringify(v) : String(v))).join(' ');
11
- logs.unshift({
12
- type,
13
- msg,
14
- time,
15
- blockLines: 2
16
- });
17
- uni.setStorageSync(STORAGE_KEY, logs);
18
- };
19
- });
20
- }
@@ -1,299 +0,0 @@
1
- <template>
2
- <view
3
- v-if="!visible"
4
- class="console-toggle"
5
- :style="{ left: btnPos.x + 'rpx', top: btnPos.y + 'rpx' }"
6
- @touchstart="onTouchStart"
7
- @touchmove="onTouchMove"
8
- @touchend="onTouchEnd"
9
- @mousedown="onTouchStart"
10
- @mousemove="onTouchMove"
11
- @mouseup="onTouchEnd"
12
- @click="toggle"
13
- >
14
- <v-button>控制台</v-button>
15
- </view>
16
- <view v-if="visible" class="v-console" :class="{ expanded: expanded }">
17
- <view class="toolbar">
18
- <view class="buttons">
19
- <v-text-button size="medium" @click="toggle">关闭</v-text-button>
20
- <v-text-button size="medium" @click="toggleExpand">
21
- {{ expanded ? '收起' : '展开' }}
22
- </v-text-button>
23
- <v-text-button size="medium" @click="clear">清空</v-text-button>
24
- </view>
25
- <view class="filter">
26
- <v-input v-model="keyword" placeholder="关键字筛选" class="keyword" @confirm="onKeywordConfirm" />
27
- <v-select-picker :options="levels" :value="levelIndex" @confirm="onLevelConfirm" class="level" />
28
- </view>
29
- </view>
30
- <scroll-view scroll-y class="list">
31
- <view v-for="(log, i) in showList" :key="i" :class="'log ' + log.type">
32
- <text v-if="log.time" class="time">{{ log.time }} {{ log.type }}</text>
33
- <!-- <v-text :class="['msg', log.type]" :lines="log.blockLines" @longpress="copyLog(log.msg)">{{ log.msg }}</v-text> -->
34
- <view class="msg" :class="log.type" @longpress="copyLog(log.msg)">
35
- <v-text :lines="log.blockLines">{{ log.msg }}</v-text>
36
- </view>
37
- <v-text-button class="detail-info" @click="log.blockLines == 2 ? (log.blockLines = 999) : (log.blockLines = 2)">
38
- {{ log.blockLines == 2 ? '详细' : '简略' }}
39
- </v-text-button>
40
- </view>
41
- </scroll-view>
42
- </view>
43
- </template>
44
-
45
- <script setup>
46
- import { ref, computed, onMounted } from 'vue';
47
-
48
- const STORAGE_KEY = 'v-console-logs';
49
- const visible = ref(false);
50
- const toggle = () => (visible.value = !visible.value);
51
-
52
- const expanded = ref(false);
53
- const toggleExpand = () => (expanded.value = !expanded.value);
54
-
55
- const logs = ref([]);
56
- const keyword = ref('');
57
- const levelIndex = ref(0);
58
- const levels = [
59
- { label: '全部', value: 0 },
60
- { label: 'log', value: 1 },
61
- { label: 'info', value: 2 },
62
- { label: 'warn', value: 3 },
63
- { label: 'error', value: 4 },
64
- { label: 'debug', value: 5 }
65
- ];
66
-
67
- const btnPos = ref({ x: 30, y: 100 });
68
- const dragging = ref(false);
69
- const startPos = ref({ x: 0, y: 0 });
70
-
71
- const rpx2px = (rpx) => (rpx * uni.getSystemInfoSync().windowWidth) / 750;
72
-
73
- onMounted(() => {
74
- loadLogs();
75
- });
76
-
77
- const getPos = (e) => {
78
- // #ifdef H5
79
- return { x: e.clientX, y: e.clientY };
80
- // #endif
81
- // #ifndef H5
82
- const touch = e.touches[0] || e.changedTouches[0];
83
- return { x: touch.clientX, y: touch.clientY };
84
- // #endif
85
- };
86
-
87
- /* 按下 */
88
- const onTouchStart = (e) => {
89
- dragging.value = true;
90
- startPos.value = getPos(e);
91
- };
92
-
93
- /* 移动 */
94
- const onTouchMove = (e) => {
95
- if (!dragging.value) return;
96
- const { windowWidth, windowHeight } = uni.getSystemInfoSync();
97
- const cur = getPos(e);
98
- const dx = cur.x - startPos.value.x;
99
- const dy = cur.y - startPos.value.y;
100
-
101
- /* 转成 rpx */
102
- const newX = btnPos.value.x + (dx * 750) / windowWidth;
103
- const newY = btnPos.value.y + (dy * 750) / windowHeight;
104
-
105
- /* 边界限制:0~屏幕宽/高 - 按钮宽/高(≈120rpx) */
106
- btnPos.value.x = Math.max(0, Math.min(newX, (windowWidth * 750) / windowWidth - 120));
107
- btnPos.value.y = Math.max(0, Math.min(newY, (windowHeight * 750) / windowWidth - 120));
108
-
109
- startPos.value = cur;
110
- };
111
-
112
- const onTouchEnd = () => (dragging.value = false);
113
-
114
- if (typeof window !== 'undefined') {
115
- window.onerror = (msg, url, line, col, error) => {
116
- console.error('[Global Error]', msg, `${url}:${line}:${col}`, error?.stack);
117
- };
118
- window.onunhandledrejection = (e) => {
119
- console.error('[Unhandled Promise]', e.reason);
120
- };
121
- } else {
122
- // #ifdef MP-WEIXIN || MP-ALIPAY || MP-BAIDU || MP-QQ
123
- wx.onError?.((res) => console.error('[wx Error]', res));
124
- wx.onUnhandledRejection?.((res) => console.error('[wx Promise]', res.reason));
125
- // #endif
126
- }
127
-
128
-
129
- ['log', 'info', 'warn', 'error', 'debug'].forEach((type) => {
130
- const origin = console[type];
131
- console[type] = (...args) => {
132
- origin.apply(console, args);
133
- const time = new Date().toLocaleTimeString();
134
- const msg = args.map((v) => (typeof v === 'object' ? JSON.stringify(v) : String(v))).join(' ');
135
- const newLog = { type, msg, time, blockLines: 2 };
136
- logs.value.unshift(newLog);
137
- saveLogs();
138
- };
139
- });
140
-
141
- const showList = computed(() => {
142
- let list = logs.value;
143
- if (levelIndex.value) {
144
- list = list.filter((l) => l.type === levels[levelIndex.value].label.toLowerCase());
145
- }
146
-
147
- if (keyword.value.trim()) {
148
- const k = keyword.value.trim().toLowerCase();
149
- list = list.filter((l) => l.msg.toLowerCase().includes(k));
150
- }
151
- list.blockLines = 2;
152
- return list;
153
- });
154
- const saveLogs = () => {
155
- try {
156
- // #ifdef H5
157
- sessionStorage.setItem(STORAGE_KEY, JSON.stringify(logs.value));
158
- // #endif
159
- // #ifndef H5
160
- uni.setStorageSync(STORAGE_KEY, logs.value);
161
- // #endif
162
- } catch (_) {}
163
- };
164
-
165
- const loadLogs = () => {
166
- try {
167
- let data = null;
168
- // #ifdef H5
169
- data = JSON.parse(sessionStorage.getItem(STORAGE_KEY) || '[]');
170
- // #endif
171
- // #ifndef H5
172
- data = uni.getStorageSync(STORAGE_KEY) || [];
173
- // #endif
174
- logs.value = data;
175
- } catch (_) {}
176
- };
177
-
178
- const clear = () => {
179
- logs.value = [];
180
- try {
181
- // #ifdef H5
182
- sessionStorage.removeItem(STORAGE_KEY);
183
- // #endif
184
- // #ifndef H5
185
- uni.removeStorageSync(STORAGE_KEY);
186
- // #endif
187
- } catch (_) {}
188
- };
189
-
190
- const copyLog = (msg) => {
191
- // #ifdef H5
192
- const input = document.createElement('textarea');
193
- input.value = msg;
194
- document.body.appendChild(input);
195
- input.select();
196
- document.execCommand('copy');
197
- document.body.removeChild(input);
198
- uni.showToast({ title: '已复制', icon: 'none' });
199
- // #endif
200
- // #ifndef H5
201
- uni.setClipboardData({ data: msg, showToast: false });
202
- uni.showToast({ title: '已复制', icon: 'none' });
203
- // #endif
204
- };
205
- const onKeywordConfirm = (e) => {
206
- console.log(e);
207
- keyword.value = e;
208
- };
209
- const onLevelConfirm = (e) => {
210
- levelIndex.value = e;
211
- };
212
- </script>
213
-
214
- <style lang="scss" scoped>
215
- /* 悬浮开关按钮(黑底白字) */
216
- .console-toggle {
217
- position: fixed;
218
- right: 30rpx;
219
- bottom: 100rpx;
220
- z-index: 10000;
221
- }
222
-
223
- /* 控制台主体:白底黑字 */
224
- .v-console {
225
- position: fixed;
226
- left: 0;
227
- right: 0;
228
- bottom: 0;
229
- z-index: 9999;
230
- background: #fff;
231
- color: #000;
232
- font-family: monospace;
233
- font-size: 0.75rem;
234
- height: 120rpx; /* 默认收缩高度 */
235
- transition: height 0.25s ease;
236
- border-top: 1rpx solid #e5e5e5;
237
-
238
- &.expanded {
239
- height: 50%; /* 展开后高度 */
240
- }
241
-
242
- .toolbar {
243
- display: flex;
244
- padding: 12rpx 24rpx;
245
- background: #f7f7f7;
246
- border-bottom: 1rpx solid #e5e5e5;
247
- flex-direction: column;
248
- .buttons {
249
- display: flex;
250
- }
251
- .filter {
252
- display: flex;
253
- .keyword {
254
- flex: 1;
255
- margin-right: 20rpx;
256
- }
257
- .level {
258
- width: 200rpx;
259
- :deep(.select-input) {
260
- height: 60rpx;
261
- line-height: 60rpx;
262
- }
263
- }
264
- }
265
- }
266
-
267
- .list {
268
- height: calc(100% - 100rpx);
269
- padding: 16rpx;
270
- .log {
271
- display: flex;
272
- line-height: 1.4;
273
- margin-bottom: 8rpx;
274
- .time {
275
- margin-right: 12rpx;
276
- color: #666;
277
- }
278
- .msg {
279
- width: 50%;
280
- &.log {
281
- color: #008000;
282
- }
283
- &.info {
284
- color: #0066cc;
285
- }
286
- &.warn {
287
- color: #ff6600;
288
- }
289
- &.error {
290
- color: #cc0000;
291
- }
292
- &.debug {
293
- color: #666;
294
- }
295
- }
296
- }
297
- }
298
- }
299
- </style>
@@ -1,261 +0,0 @@
1
- <template>
2
- <v-popup v-model:value="isPopupVisible" :title="title" :scrollHeight="scrollHeight" model="semicircle" @close="handleClose" @confirm="handleConfirm">
3
- <view class="drum-select-container">
4
- <view class="drum-select-content">
5
- <v-scroll-list
6
- :value="value.getFullYear()"
7
- :options="generateYearRange(props.maxDateTime.getFullYear(), props.minDateTime.getFullYear())"
8
- :scrollHeight="scrollHeight"
9
- @update:value="handleValueChangeYear($event)"
10
- />
11
- <v-text class="separate-symbol">:</v-text>
12
- <v-scroll-list
13
- :value="value.getMonth() + 1"
14
- :options="generateMonthRange(props.maxDateTime.getMonth(), props.minDateTime.getMonth())"
15
- :scrollHeight="scrollHeight"
16
- @update:value="handleValueChangeMonth($event)"
17
- />
18
- <v-text class="separate-symbol">:</v-text>
19
- <v-scroll-list
20
- :value="value.getDate()"
21
- :options="generateDateRange(props.maxDateTime.getDate(), props.minDateTime.getDate())"
22
- :scrollHeight="scrollHeight"
23
- @update:value="handleValueChangeDate($event)"
24
- />
25
- <v-text class="separate-symbol">:</v-text>
26
- <v-scroll-list
27
- :value="hoursSystem ? value.getHours() || 24 : value.getHours() % 12 || 12"
28
- :options="generateHoursRange(props.maxDateTime.getHours(), props.minDateTime.getHours())"
29
- :scrollHeight="scrollHeight"
30
- @update:value="handleValueChangeHours($event)"
31
- />
32
- <v-text class="separate-symbol">:</v-text>
33
- <v-scroll-list
34
- :value="value.getMinutes()"
35
- :options="generateMinutesRange(props.maxDateTime.getMinutes(), props.minDateTime.getMinutes())"
36
- :scrollHeight="scrollHeight"
37
- @update:value="handleValueChangeMinutes($event)"
38
- />
39
- <v-text class="separate-symbol">:</v-text>
40
- <v-scroll-list
41
- :value="value.getSeconds()"
42
- :options="generateSecondsRange(props.maxDateTime.getSeconds(), props.minDateTime.getSeconds())"
43
- :scrollHeight="scrollHeight"
44
- @update:value="handleValueChangeSeconds($event)"
45
- />
46
- </view>
47
- </view>
48
- </v-popup>
49
- </template>
50
-
51
- <script lang="ts" setup>
52
- import { ref, computed, watch, inject } from 'vue';
53
-
54
- interface DrumSelectPicker {
55
- value: any;
56
- label: string;
57
- children?: DrumSelectPicker[];
58
- }
59
- const props = defineProps({
60
- title: {
61
- type: String,
62
- default: '',
63
- required: true
64
- },
65
- scrollHeight: {
66
- type: Number,
67
- default: 400
68
- },
69
- value: {
70
- type: Date,
71
- default: new Date(),
72
- required: true
73
- },
74
- show: {
75
- type: Boolean,
76
- default: true
77
- },
78
- minDateTime: {
79
- type: Date,
80
- default: new Date('1000-1-1'),
81
- required: true
82
- },
83
- maxDateTime: {
84
- type: Date,
85
- default: new Date('9999-12-31'),
86
- required: true
87
- },
88
- hoursSystem: {
89
- type: Boolean,
90
- default: false
91
- }
92
- });
93
-
94
- const emit = defineEmits([
95
- 'update:value',
96
- 'handleValueChangeYear',
97
- 'handleValueChangeMonth',
98
- 'handleValueChangeDate',
99
- 'handleValueChangeHours',
100
- 'handleValueChangeMinutes',
101
- 'handleValueChangeSeconds',
102
- 'close',
103
- 'confirm',
104
- 'update:show'
105
- ]);
106
-
107
- const isPopupVisible = ref(props.show);
108
- const config = inject<any>('config');
109
- function generateYearRange(maxYear: any, minYear: any) {
110
- const yearRange = [];
111
- for (let year = maxYear; year >= minYear; year--) {
112
- yearRange.push({
113
- value: year,
114
- label: `${year}`
115
- });
116
- }
117
- return yearRange;
118
- }
119
-
120
- function generateMonthRange(maxMonth: any, minMonth: any) {
121
- const monthRange = [];
122
- for (let month = maxMonth + 1; month > minMonth; month--) {
123
- monthRange.push({
124
- value: month,
125
- label: `${month}`
126
- });
127
- }
128
- return monthRange;
129
- }
130
-
131
- function generateDateRange(maxDate: any, minDate: any) {
132
- const dayRange = [];
133
- const daysInMonth = new Date(props.value.getFullYear(), props.value.getMonth() + 1, 0).getDate();
134
- const actualMaxDate = Math.min(maxDate, daysInMonth);
135
- for (let day = actualMaxDate; day >= minDate; day--) {
136
- dayRange.push({
137
- value: day,
138
- label: `${day}`
139
- });
140
- }
141
- return dayRange;
142
- }
143
-
144
- function generateHoursRange() {
145
- const hoursRange = [];
146
- if (props.hoursSystem) {
147
- // 24小时制
148
- for (let hour = 24; hour > 0; hour--) {
149
- hoursRange.push({
150
- value: hour,
151
- label: `${hour}`
152
- });
153
- }
154
- } else {
155
- // 12小时制
156
- for (let hour = 12; hour >= 1; hour--) {
157
- hoursRange.push({
158
- value: hour,
159
- label: `${hour}`
160
- });
161
- }
162
- }
163
- return hoursRange;
164
- }
165
-
166
- function generateMinutesRange() {
167
- const minutesRange = [];
168
- for (let minute = 60; minute > 0; minute--) {
169
- minutesRange.push({
170
- value: minute,
171
- label: `${minute < 10 ? '0' + minute : minute}`
172
- });
173
- }
174
- return minutesRange;
175
- }
176
-
177
- function generateSecondsRange() {
178
- const secondsRange = [];
179
- for (let second = 60; second > 0; second--) {
180
- secondsRange.push({
181
- value: second,
182
- label: `${second < 10 ? '0' + second : second}`
183
- });
184
- }
185
- return secondsRange;
186
- }
187
-
188
- const handleValueChangeYear = (year: number) => {
189
- props.value.setFullYear(year);
190
- emit('handleValueChangeYear', year);
191
- };
192
- const handleValueChangeMonth = (month: number) => {
193
- props.value.setMonth(month);
194
- emit('handleValueChangeMonth', month);
195
- };
196
- const handleValueChangeDate = (date: number) => {
197
- props.value.setDate(date);
198
- emit('handleValueChangeDate', date);
199
- };
200
- const handleValueChangeHours = (hours: number) => {
201
- props.value.setHours(hours);
202
- emit('handleValueChangeHours', hours);
203
- };
204
- const handleValueChangeMinutes = (minutes: number) => {
205
- props.value.setMinutes(minutes);
206
- emit('handleValueChangeMinutes', minutes);
207
- };
208
- const handleValueChangeSeconds = (seconds: number) => {
209
- props.value.setSeconds(seconds);
210
- emit('handleValueChangeSeconds', seconds);
211
- };
212
-
213
- watch(
214
- () => props.show,
215
- (val) => {
216
- isPopupVisible.value = val;
217
- }
218
- );
219
-
220
- const handleClose = () => {
221
- isPopupVisible.value = false;
222
- emit('update:show', false);
223
- emit('close', false);
224
- };
225
- const handleConfirm = () => {
226
- isPopupVisible.value = false;
227
- emit('update:show', false);
228
- emit('confirm', props.value);
229
- };
230
- </script>
231
-
232
- <style lang="scss" scoped>
233
- .drum-select-container {
234
- position: relative;
235
- width: 100%;
236
- height: 100%;
237
- display: flex;
238
- align-items: center;
239
- }
240
-
241
- .drum-select-content {
242
- position: relative;
243
- width: 100%;
244
- height: 60%;
245
- overflow: hidden;
246
- display: flex;
247
- view {
248
- flex: 1;
249
- }
250
- }
251
-
252
- .separate-symbol {
253
- font-size: v-bind("config.fontSize.mediumText");
254
- height: 85rpx;
255
- line-height: 85rpx !important;
256
- display: block !important;
257
- background-color: v-bind('config.VDateTime.backgroundColor');
258
- border-top: 1rpx solid v-bind('config.border.color');
259
- border-bottom: 1rpx solid v-bind('config.border.color');
260
- }
261
- </style>