uview-plus 3.8.49 → 3.8.86

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 (170) hide show
  1. package/changelog.md +2043 -1827
  2. package/components/u-action-sheet/props.js +3 -1
  3. package/components/u-action-sheet/u-action-sheet.vue +1 -0
  4. package/components/u-album/props.js +3 -1
  5. package/components/u-alert/props.js +4 -2
  6. package/components/u-avatar/props.js +4 -1
  7. package/components/u-avatar-group/props.js +4 -1
  8. package/components/u-back-top/props.js +4 -1
  9. package/components/u-badge/props.js +4 -1
  10. package/components/u-barcode/u-barcode.vue +46 -15
  11. package/components/u-box/props.js +5 -2
  12. package/components/u-button/props.js +4 -1
  13. package/components/u-button/vue.scss +3 -3
  14. package/components/u-calendar/calendar.js +14 -2
  15. package/components/u-calendar/month.vue +41 -6
  16. package/components/u-calendar/props.js +63 -1
  17. package/components/u-calendar/u-calendar.vue +311 -2
  18. package/components/u-calendar-strip/props.js +3 -1
  19. package/components/u-canvas/u-canvas.vue +734 -423
  20. package/components/u-car-keyboard/props.js +3 -1
  21. package/components/u-card/props.js +3 -1
  22. package/components/u-cell/props.js +4 -1
  23. package/components/u-cell/u-cell.vue +1 -1
  24. package/components/u-cell-group/props.js +4 -1
  25. package/components/u-checkbox/props.js +4 -1
  26. package/components/u-checkbox/u-checkbox.vue +7 -3
  27. package/components/u-checkbox-group/props.js +3 -1
  28. package/components/u-circle-progress/props.js +4 -1
  29. package/components/u-code/props.js +4 -1
  30. package/components/u-code-input/props.js +4 -1
  31. package/components/u-col/props.js +4 -1
  32. package/components/u-collapse/props.js +4 -1
  33. package/components/u-collapse-item/props.js +4 -1
  34. package/components/u-color-picker/u-color-picker.vue +1 -0
  35. package/components/u-column-notice/props.js +4 -1
  36. package/components/u-count-down/props.js +4 -1
  37. package/components/u-count-to/props.js +4 -1
  38. package/components/u-cropper/u-cropper.vue +95 -51
  39. package/components/u-datetime-picker/props.js +4 -1
  40. package/components/u-divider/props.js +4 -1
  41. package/components/u-dragsort/u-dragsort.vue +2 -1
  42. package/components/u-dropdown/props.js +3 -1
  43. package/components/u-dropdown-item/props.js +3 -1
  44. package/components/u-empty/props.js +4 -1
  45. package/components/u-form/props.js +4 -1
  46. package/components/u-form-item/props.js +4 -1
  47. package/components/u-gap/props.js +4 -1
  48. package/components/u-grid/props.js +4 -1
  49. package/components/u-grid-item/props.js +4 -1
  50. package/components/u-guide/props.js +3 -1
  51. package/components/u-icon/props.js +4 -1
  52. package/components/u-icon/u-icon.vue +2 -2
  53. package/components/u-icon/upicon.ttf +0 -0
  54. package/components/u-icon/util.js +29 -7
  55. package/components/u-image/props.js +4 -1
  56. package/components/u-image/u-image.vue +280 -267
  57. package/components/u-index-anchor/props.js +4 -1
  58. package/components/u-index-item/props.js +2 -1
  59. package/components/u-index-list/props.js +4 -1
  60. package/components/u-input/props.js +3 -1
  61. package/components/u-input/u-input.vue +10 -1
  62. package/components/u-keyboard/props.js +4 -1
  63. package/components/u-line/props.js +4 -1
  64. package/components/u-line-progress/props.js +6 -3
  65. package/components/u-link/props.js +4 -1
  66. package/components/u-list/props.js +4 -1
  67. package/components/u-list-item/props.js +4 -1
  68. package/components/u-loading-icon/props.js +4 -1
  69. package/components/u-loading-page/props.js +3 -1
  70. package/components/u-loadmore/props.js +4 -1
  71. package/components/u-markdown/u-markdown.vue +45 -3
  72. package/components/u-modal/props.js +4 -1
  73. package/components/u-navbar/props.js +4 -2
  74. package/components/u-navbar/u-navbar.vue +15 -9
  75. package/components/u-no-network/props.js +4 -1
  76. package/components/u-notice-bar/props.js +4 -1
  77. package/components/u-notify/props.js +4 -1
  78. package/components/u-number-box/props.js +4 -1
  79. package/components/u-number-box/u-number-box.vue +2 -2
  80. package/components/u-number-keyboard/props.js +4 -1
  81. package/components/u-overlay/props.js +4 -1
  82. package/components/u-pagination/u-pagination.vue +60 -39
  83. package/components/u-parse/props.js +4 -1
  84. package/components/u-picker/props.js +4 -1
  85. package/components/u-picker/u-picker.vue +15 -0
  86. package/components/u-picker-column/props.js +3 -1
  87. package/components/u-popover/props.js +2 -1
  88. package/components/u-popup/props.js +4 -1
  89. package/components/u-poster/u-poster.vue +29 -14
  90. package/components/u-qrcode/qrcode.js +88 -87
  91. package/components/u-qrcode/u-qrcode.vue +138 -256
  92. package/components/u-radio/props.js +4 -1
  93. package/components/u-radio/u-radio.vue +7 -3
  94. package/components/u-radio-group/props.js +4 -1
  95. package/components/u-rate/props.js +4 -1
  96. package/components/u-read-more/props.js +4 -1
  97. package/components/u-row/props.js +4 -1
  98. package/components/u-row-notice/props.js +4 -1
  99. package/components/u-safe-bottom/props.js +2 -1
  100. package/components/u-scroll-list/props.js +4 -1
  101. package/components/u-search/props.js +3 -1
  102. package/components/u-skeleton/props.js +4 -1
  103. package/components/u-slider/props.js +3 -1
  104. package/components/u-slider/u-slider.vue +70 -28
  105. package/components/u-status-bar/props.js +4 -1
  106. package/components/u-steps/props.js +4 -1
  107. package/components/u-steps-item/props.js +4 -1
  108. package/components/u-sticky/props.js +4 -1
  109. package/components/u-sticky/u-sticky.vue +11 -0
  110. package/components/u-subsection/props.js +3 -1
  111. package/components/u-swipe-action/props.js +4 -1
  112. package/components/u-swipe-action-item/props.js +4 -1
  113. package/components/u-swipe-action-item/u-swipe-action-item.vue +14 -0
  114. package/components/u-swiper/props.js +9 -1
  115. package/components/u-swiper/swiper.js +1 -0
  116. package/components/u-swiper/u-swiper.vue +2 -0
  117. package/components/u-swiper-indicator/props.js +4 -1
  118. package/components/u-switch/props.js +4 -1
  119. package/components/u-tabbar/props.js +3 -1
  120. package/components/u-tabbar-item/props.js +4 -1
  121. package/components/u-table/props.js +3 -1
  122. package/components/u-table2/tableRow.vue +155 -69
  123. package/components/u-table2/u-table2.vue +328 -140
  124. package/components/u-tabs/props.js +4 -1
  125. package/components/u-tabs-item/props.js +3 -1
  126. package/components/u-tag/props.js +4 -1
  127. package/components/u-td/props.js +3 -1
  128. package/components/u-text/props.js +4 -1
  129. package/components/u-textarea/props.js +3 -1
  130. package/components/u-textarea/u-textarea.vue +16 -5
  131. package/components/u-th/props.js +3 -1
  132. package/components/u-toolbar/props.js +4 -1
  133. package/components/u-tooltip/props.js +10 -2
  134. package/components/u-tooltip/tooltip.js +2 -1
  135. package/components/u-tooltip/u-tooltip.vue +31 -3
  136. package/components/u-tr/props.js +3 -1
  137. package/components/u-transition/nvue-ani-map.js +75 -68
  138. package/components/u-transition/props.js +4 -1
  139. package/components/u-transition/transitionMixin.js +164 -163
  140. package/components/u-upload/props.js +4 -1
  141. package/components/u-upload/u-upload.vue +47 -40
  142. package/components/u-waterfall/u-waterfall.vue +50 -51
  143. package/index.js +65 -8
  144. package/libs/config/props.js +179 -204
  145. package/libs/css/components.scss +3 -0
  146. package/libs/function/uni-api-shims.js +29 -0
  147. package/libs/i18n/index.js +71 -36
  148. package/libs/i18n/locale-packs.js +11 -0
  149. package/libs/i18n/locales/all.js +23 -0
  150. package/libs/i18n/locales/{de.json → de.js} +1 -1
  151. package/libs/i18n/locales/{en.json → en.js} +2 -2
  152. package/libs/i18n/locales/{es.json → es.js} +1 -1
  153. package/libs/i18n/locales/{fr.json → fr.js} +2 -2
  154. package/libs/i18n/locales/{ja.json → ja.js} +1 -1
  155. package/libs/i18n/locales/{ko.json → ko.js} +1 -1
  156. package/libs/i18n/locales/{ru.json → ru.js} +1 -1
  157. package/libs/i18n/locales/{th.json → th.js} +1 -1
  158. package/libs/i18n/locales/{zh-Hans.json → zh-Hans.js} +1 -1
  159. package/libs/i18n/locales/{zh-Hant.json → zh-Hant.js} +1 -1
  160. package/libs/mixin/mixin.js +14 -4
  161. package/libs/util/gcanvas/bridge/bridge-weex.js +10 -5
  162. package/package.json +4 -5
  163. package/tsconfig.json +18 -0
  164. package/types/comps/calendar.d.ts +57 -0
  165. package/types/comps/checkbox.d.ts +12 -0
  166. package/types/comps/lineProgress.d.ts +5 -0
  167. package/types/comps/navbar.d.ts +3 -3
  168. package/types/comps/swiper.d.ts +5 -0
  169. package/types/comps/tooltip.d.ts +36 -1
  170. /package/components/u-markdown/{marked.esm.js → marked.esm.mjs} +0 -0
@@ -2,6 +2,14 @@
2
2
  <u-popup
3
3
  :show="show"
4
4
  mode="bottom"
5
+ :overlay="overlay"
6
+ :duration="duration"
7
+ :overlayStyle="overlayStyle"
8
+ :overlayOpacity="overlayOpacity"
9
+ :zIndex="zIndex"
10
+ :safeAreaInsetBottom="safeAreaInsetBottom"
11
+ :safeAreaInsetTop="safeAreaInsetTop"
12
+ :bgColor="bgColor"
5
13
  :closeable="!pageInline"
6
14
  @close="close"
7
15
  :round="round"
@@ -29,6 +37,28 @@
29
37
  @nextYear="nextYear"
30
38
  @today="jumpToToday"
31
39
  ></uHeader>
40
+ <view v-if="showTimePanel" class="u-calendar__time-panel">
41
+ <view v-if="mode === 'single'" class="u-calendar__time-row">
42
+ <text class="u-calendar__time-date">{{ singleDateLabel }}</text>
43
+ <view class="u-calendar__time-trigger" @click="openTimePicker('single')">
44
+ <text class="u-calendar__time-text">{{ singleTime }}</text>
45
+ </view>
46
+ </view>
47
+ <view v-else-if="mode === 'range' && rangeResultMode === 'boundary'">
48
+ <view class="u-calendar__time-row">
49
+ <text class="u-calendar__time-date">{{ rangeStartDateLabel }}</text>
50
+ <view class="u-calendar__time-trigger" @click="openTimePicker('start')">
51
+ <text class="u-calendar__time-text">{{ rangeStartTime }}</text>
52
+ </view>
53
+ </view>
54
+ <view class="u-calendar__time-row">
55
+ <text class="u-calendar__time-date">{{ rangeEndDateLabel }}</text>
56
+ <view class="u-calendar__time-trigger" @click="openTimePicker('end')">
57
+ <text class="u-calendar__time-text">{{ rangeEndTime }}</text>
58
+ </view>
59
+ </view>
60
+ </view>
61
+ </view>
32
62
  <scroll-view
33
63
  v-if="!monthSwitch"
34
64
  :style="{
@@ -61,6 +91,7 @@
61
91
  :forbidDaysToast="forbidDaysToast"
62
92
  :monthFormat="monthFormat"
63
93
  :todayDate="todayDate"
94
+ :todayColor="todayColor"
64
95
  ref="month"
65
96
  @monthSelected="monthSelected"
66
97
  @updateMonthTop="onUpdateMonthTop"
@@ -94,6 +125,7 @@
94
125
  :forbidDaysToast="forbidDaysToast"
95
126
  :monthFormat="monthFormat"
96
127
  :todayDate="todayDate"
128
+ :todayColor="todayColor"
97
129
  ref="month"
98
130
  @monthSelected="monthSelected"
99
131
  @updateMonthTop="onUpdateMonthTop"
@@ -114,6 +146,32 @@
114
146
  </slot>
115
147
  </view>
116
148
  </u-popup>
149
+ <u-popup
150
+ :show="timePickerShow"
151
+ mode="center"
152
+ :round="8"
153
+ :closeOnClickOverlay="true"
154
+ @close="closeTimePicker"
155
+ >
156
+ <view class="u-calendar__time-picker">
157
+ <view class="u-calendar__time-picker__header">
158
+ <text class="u-calendar__time-picker__cancel" @click="closeTimePicker">取消</text>
159
+ <text class="u-calendar__time-picker__title">选择时间</text>
160
+ <text class="u-calendar__time-picker__confirm" @click="confirmTimePicker">确定</text>
161
+ </view>
162
+ <picker-view class="u-calendar__time-picker__body" :value="timePickerValue" @change="onTimePickerChange">
163
+ <picker-view-column>
164
+ <view v-for="(item, index) in hourOptions" :key="`h-${index}`" class="u-calendar__time-picker__item">{{ item }}</view>
165
+ </picker-view-column>
166
+ <picker-view-column v-if="timePrecision !== 'hour'">
167
+ <view v-for="(item, index) in minuteOptions" :key="`m-${index}`" class="u-calendar__time-picker__item">{{ item }}</view>
168
+ </picker-view-column>
169
+ <picker-view-column v-if="timePrecision === 'second'">
170
+ <view v-for="(item, index) in secondOptions" :key="`s-${index}`" class="u-calendar__time-picker__item">{{ item }}</view>
171
+ </picker-view-column>
172
+ </picker-view>
173
+ </view>
174
+ </u-popup>
117
175
  </template>
118
176
 
119
177
  <script>
@@ -152,6 +210,14 @@ import { t } from '../../libs/i18n'
152
210
  * @property {String} confirmText 确定按钮的文字 (默认 '确定' )
153
211
  * @property {String} confirmDisabledText 确认按钮处于禁用状态时的文字 (默认 '确定' )
154
212
  * @property {Boolean} show 是否显示日历弹窗 (默认 false )
213
+ * @property {Boolean} overlay 是否显示遮罩 (默认 true )
214
+ * @property {String | Number} duration 动画时长,单位ms (默认 300 )
215
+ * @property {Object | String} overlayStyle 自定义遮罩的样式
216
+ * @property {Number | String} overlayOpacity 遮罩透明度,0-1之间 (默认 0.5 )
217
+ * @property {String | Number} zIndex 弹出层的z-index值 (默认 10075 )
218
+ * @property {Boolean} safeAreaInsetBottom 是否留出底部安全距离 (默认 true )
219
+ * @property {Boolean} safeAreaInsetTop 是否留出顶部安全距离(状态栏高度) (默认 false )
220
+ * @property {String} bgColor 弹窗背景色,设置为transparent可去除白色背景
155
221
  * @property {Boolean} closeOnClickOverlay 是否允许点击遮罩关闭日历 (默认 false )
156
222
  * @property {Boolean} readonly 是否为只读状态,只读状态下禁止选择日期 (默认 false )
157
223
  * @property {String | Number} maxRange 日期区间最多可选天数,默认无限制,mode = range时有效
@@ -159,9 +225,13 @@ import { t } from '../../libs/i18n'
159
225
  * @property {Boolean} showRangePrompt 范围选择超过最多可选天数时,是否展示提示文案,mode = range时有效 (默认 true )
160
226
  * @property {Boolean} allowSameDay 是否允许日期范围的起止时间为同一天,mode = range时有效 (默认 false )
161
227
  * @property {String} rangeResultMode 区间模式下确认返回值格式,all-返回区间内所有日期,boundary-仅返回起止日期 (默认 'all' )
228
+ * @property {Boolean} enableTime 是否开启时分秒选择 (默认 false )
229
+ * @property {String} timePrecision 时间精度,hour-仅时,minute-时分,second-时分秒 (默认 'minute' )
230
+ * @property {String} defaultTime 默认时间,支持HH/HH:mm/HH:mm:ss,不传则按00:00补齐
162
231
  * @property {Number|String} round 圆角值,默认无圆角 (默认 0 )
163
232
  * @property {Number|String} monthNum 最多展示的月份数量 (默认 3 )
164
233
  * @property {Boolean} monthSwitch 是否启用非滚动的单月切换模式 (默认 false )
234
+ * @property {String} todayColor 今天日期的独立高亮颜色,默认跟随主题色
165
235
  * @property {Array} weekText 星期文案 (默认 ['一', '二', '三', '四', '五', '六', '日'] )
166
236
  *
167
237
  * @event {Function()} confirm 点击确定按钮时触发 选择日期相关的返回参数
@@ -189,6 +259,15 @@ export default {
189
259
  scrollIntoView: '',
190
260
  scrollIntoViewScroll: '',
191
261
  scrollTop:0,
262
+ timePickerShow: false,
263
+ timePickerTarget: 'single',
264
+ timePickerValue: [0, 0, 0],
265
+ hourOptions: [],
266
+ minuteOptions: [],
267
+ secondOptions: [],
268
+ singleTime: '00:00',
269
+ rangeStartTime: '00:00',
270
+ rangeEndTime: '00:00',
192
271
  // 过滤处理方法
193
272
  innerFormatter: (value) => value
194
273
  }
@@ -206,6 +285,13 @@ export default {
206
285
  this.setMonth()
207
286
  }
208
287
  },
288
+ timePrecision() {
289
+ this.initTimeOptions()
290
+ this.initTimeValues()
291
+ },
292
+ defaultTime() {
293
+ this.initTimeValues()
294
+ },
209
295
  // 打开弹窗时,设置月份数据
210
296
  show: {
211
297
  immediate: true,
@@ -288,6 +374,26 @@ export default {
288
374
  switchNextYearDisabled() {
289
375
  return this.monthIndex + 12 > this.months.length - 1
290
376
  },
377
+ showTimePanel() {
378
+ if (!this.enableTime) return false
379
+ if (this.mode === 'single') return true
380
+ if (this.mode === 'range' && this.rangeResultMode === 'boundary') {
381
+ return true
382
+ }
383
+ return false
384
+ },
385
+ singleDateLabel() {
386
+ return this.selected[0] || '--'
387
+ },
388
+ rangeStartDateLabel() {
389
+ return this.selected[0] || '--'
390
+ },
391
+ rangeEndDateLabel() {
392
+ if (this.selected.length >= 2) {
393
+ return this.selected[this.selected.length - 1]
394
+ }
395
+ return '--'
396
+ },
291
397
  buttonDisabled() {
292
398
  // 如果为range类型,且选择的日期个数不足1个时,让底部的按钮出于disabled状态
293
399
  if (this.mode === 'range') {
@@ -308,16 +414,129 @@ export default {
308
414
  emits: ["confirm", "close"],
309
415
  methods: {
310
416
  addUnit,
417
+ padTime(num) {
418
+ return String(num).padStart(2, '0')
419
+ },
420
+ initTimeOptions() {
421
+ this.hourOptions = Array.from({ length: 24 }, (_, i) => this.padTime(i))
422
+ this.minuteOptions = Array.from({ length: 60 }, (_, i) => this.padTime(i))
423
+ this.secondOptions = Array.from({ length: 60 }, (_, i) => this.padTime(i))
424
+ },
425
+ parseTimeValue(value = '') {
426
+ const raw = String(value || '').trim()
427
+ const parts = raw.length ? raw.split(':') : []
428
+ const getNumber = (index, max) => {
429
+ const current = Number(parts[index] || 0)
430
+ if (Number.isNaN(current)) return 0
431
+ return Math.max(0, Math.min(max, current))
432
+ }
433
+ const hour = getNumber(0, 23)
434
+ const minute = getNumber(1, 59)
435
+ const second = getNumber(2, 59)
436
+ return [hour, minute, second]
437
+ },
438
+ getDefaultTimeValue() {
439
+ const [hour, minute, second] = this.parseTimeValue(this.defaultTime)
440
+ if (this.timePrecision === 'hour') {
441
+ return this.padTime(hour)
442
+ }
443
+ if (this.timePrecision === 'second') {
444
+ return `${this.padTime(hour)}:${this.padTime(minute)}:${this.padTime(second)}`
445
+ }
446
+ return `${this.padTime(hour)}:${this.padTime(minute)}`
447
+ },
448
+ initTimeValues() {
449
+ const value = this.getDefaultTimeValue()
450
+ this.singleTime = value
451
+ this.rangeStartTime = value
452
+ this.rangeEndTime = value
453
+ },
454
+ timeToPickerValue(value = '') {
455
+ const [hour, minute, second] = this.parseTimeValue(value)
456
+ return [hour, minute, second]
457
+ },
458
+ pickerValueToTime(value = []) {
459
+ const hour = Number(value[0] || 0)
460
+ const minute = Number(value[1] || 0)
461
+ const second = Number(value[2] || 0)
462
+ if (this.timePrecision === 'hour') {
463
+ return this.padTime(hour)
464
+ }
465
+ if (this.timePrecision === 'second') {
466
+ return `${this.padTime(hour)}:${this.padTime(minute)}:${this.padTime(second)}`
467
+ }
468
+ return `${this.padTime(hour)}:${this.padTime(minute)}`
469
+ },
470
+ openTimePicker(target) {
471
+ this.timePickerTarget = target
472
+ let currentValue = this.singleTime
473
+ if (target === 'start') currentValue = this.rangeStartTime
474
+ if (target === 'end') currentValue = this.rangeEndTime
475
+ this.timePickerValue = this.timeToPickerValue(currentValue)
476
+ this.timePickerShow = true
477
+ },
478
+ onTimePickerChange(e) {
479
+ this.timePickerValue = e.detail.value
480
+ },
481
+ closeTimePicker() {
482
+ this.timePickerShow = false
483
+ },
484
+ confirmTimePicker() {
485
+ const value = this.pickerValueToTime(this.timePickerValue)
486
+ if (this.timePickerTarget === 'single') this.singleTime = value
487
+ if (this.timePickerTarget === 'start') this.rangeStartTime = value
488
+ if (this.timePickerTarget === 'end') this.rangeEndTime = value
489
+ this.timePickerShow = false
490
+ },
491
+ timeToSecond(timeText = '') {
492
+ const [hour, minute, second] = this.parseTimeValue(timeText)
493
+ return hour * 3600 + minute * 60 + second
494
+ },
495
+ validateSameDayRangeTime() {
496
+ if (!this.enableTime || this.mode !== 'range' || this.rangeResultMode !== 'boundary') {
497
+ return true
498
+ }
499
+ if (this.selected.length < 2) return true
500
+ const startDate = this.selected[0]
501
+ const endDate = this.selected[this.selected.length - 1]
502
+ if (startDate !== endDate) return true
503
+ const startSeconds = this.timeToSecond(this.rangeStartTime)
504
+ const endSeconds = this.timeToSecond(this.rangeEndTime)
505
+ if (endSeconds < startSeconds) {
506
+ uni.showToast({
507
+ title: '结束时间不能早于开始时间',
508
+ icon: 'none'
509
+ })
510
+ return false
511
+ }
512
+ return true
513
+ },
514
+ appendTime(dateText, timeText) {
515
+ return `${dateText} ${timeText}`
516
+ },
311
517
  getConfirmValue(selected = this.selected) {
518
+ let result = selected
312
519
  if (
313
520
  this.mode === 'range' &&
314
521
  this.rangeResultMode === 'boundary' &&
315
522
  selected.length >= 2
316
523
  ) {
317
524
  const len = selected.length - 1
318
- return [selected[0], selected[len]]
525
+ result = [selected[0], selected[len]]
526
+ }
527
+ if (!this.showTimePanel || !this.enableTime) {
528
+ return result
529
+ }
530
+ if (this.mode === 'single' && result.length >= 1) {
531
+ return [this.appendTime(result[0], this.singleTime)]
532
+ }
533
+ if (this.mode === 'range' && this.rangeResultMode === 'boundary' && result.length >= 2) {
534
+ return [
535
+ this.appendTime(result[0], this.rangeStartTime),
536
+ this.appendTime(result[1], this.rangeEndTime)
537
+ ]
319
538
  }
320
- return selected
539
+ return result
321
540
  },
322
541
  // 在微信小程序中,不支持将函数当做props参数,故只能通过ref形式调用
323
542
  setFormatter(e) {
@@ -337,6 +556,7 @@ export default {
337
556
  return
338
557
  }
339
558
  if( scene === 'tap') {
559
+ if (!this.validateSameDayRangeTime()) return
340
560
  this.$emit('confirm', this.getConfirmValue())
341
561
  }
342
562
  }
@@ -359,6 +579,8 @@ export default {
359
579
  bottomPadding = 30
360
580
  }
361
581
  this.listHeight = this.rowHeight * (this.monthSwitch ? 6 : 5) + bottomPadding
582
+ this.initTimeOptions()
583
+ this.initTimeValues()
362
584
  this.setMonth()
363
585
  },
364
586
  close() {
@@ -367,6 +589,7 @@ export default {
367
589
  // 点击确定按钮
368
590
  confirm() {
369
591
  if (!this.buttonDisabled) {
592
+ if (!this.validateSameDayRangeTime()) return
370
593
  this.$emit('confirm', this.getConfirmValue())
371
594
  }
372
595
  },
@@ -495,16 +718,24 @@ export default {
495
718
  return
496
719
  }
497
720
  const targetMonth = dayjs(this.todayDate).format('YYYY-MM')
721
+ const selectToday = () => {
722
+ if (this.mode === 'range') {
723
+ return
724
+ }
725
+ this.$refs.month && this.$refs.month.selectDate(this.todayDate)
726
+ }
498
727
  if (this.monthSwitch) {
499
728
  const todayMonthIndex = this.months.findIndex(({ year, month }) => {
500
729
  return `${year}-${padZero(month)}` === targetMonth
501
730
  })
502
731
  if (todayMonthIndex !== -1) {
503
732
  this.monthIndex = todayMonthIndex
733
+ this.$nextTick(selectToday)
504
734
  }
505
735
  return
506
736
  }
507
737
  this.scrollIntoDefaultMonth(targetMonth)
738
+ this.$nextTick(selectToday)
508
739
  },
509
740
  // 滚动到默认设置的月份
510
741
  scrollIntoDefaultMonth(selected) {
@@ -579,6 +810,84 @@ export default {
579
810
  color: var(--up-main-color, $u-main-color);
580
811
  background-color: var(--up-card-bg-color, #ffffff);
581
812
 
813
+ &__time-panel {
814
+ padding: 8px 16px 0;
815
+ }
816
+
817
+ &__time-row {
818
+ height: 34px;
819
+ display: flex;
820
+ align-items: center;
821
+ justify-content: space-between;
822
+ margin-bottom: 6px;
823
+ }
824
+
825
+ &__time-date {
826
+ font-size: 13px;
827
+ color: #303133;
828
+ }
829
+
830
+ &__time-trigger {
831
+ min-width: 92px;
832
+ height: 30px;
833
+ padding: 0 10px;
834
+ border-radius: 15px;
835
+ border: 1px solid #dcdfe6;
836
+ display: flex;
837
+ align-items: center;
838
+ justify-content: center;
839
+ }
840
+
841
+ &__time-text {
842
+ font-size: 14px;
843
+ color: #303133;
844
+ }
845
+
846
+ &__time-picker {
847
+ width: 320px;
848
+ background-color: #ffffff;
849
+ border-radius: 8px;
850
+ overflow: hidden;
851
+ }
852
+
853
+ &__time-picker__header {
854
+ height: 44px;
855
+ padding: 0 14px;
856
+ display: flex;
857
+ align-items: center;
858
+ justify-content: space-between;
859
+ border-bottom: 1px solid #f0f0f0;
860
+ }
861
+
862
+ &__time-picker__cancel {
863
+ font-size: 14px;
864
+ color: #909399;
865
+ }
866
+
867
+ &__time-picker__title {
868
+ font-size: 15px;
869
+ color: #303133;
870
+ font-weight: 600;
871
+ }
872
+
873
+ &__time-picker__confirm {
874
+ font-size: 14px;
875
+ color: #3c9cff;
876
+ }
877
+
878
+ &__time-picker__body {
879
+ width: 320px;
880
+ height: 200px;
881
+ }
882
+
883
+ &__time-picker__item {
884
+ height: 40px;
885
+ line-height: 40px;
886
+ text-align: center;
887
+ font-size: 16px;
888
+ color: #303133;
889
+ }
890
+
582
891
  &__confirm {
583
892
  padding: 7px 18px;
584
893
  }
@@ -1,6 +1,8 @@
1
1
  import { defineMixin } from '../../libs/vue'
2
- import defProps from '../../libs/config/props.js'
2
+ import CalendarStripDefaultProps from './calendarStrip'
3
+ import { registerComponentProps } from '../../libs/config/props.js'
3
4
 
5
+ const defProps = registerComponentProps(CalendarStripDefaultProps)
4
6
  export const props = defineMixin({
5
7
  props: {
6
8
  modelValue: {