Skip to content

Commit dc09874

Browse files
committed
pub(uni-datetime-picker): - 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug
- 优化 弹出层在超出视窗边缘被遮盖的问题
1 parent d150ea5 commit dc09874

File tree

6 files changed

+25
-28
lines changed

6 files changed

+25
-28
lines changed

pages/nvue/datetime-picker/datetime-picker.nvue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<view class="page">
33
<text class="example-info">可以同时选择日期和时间的选择器</text>
44
<uni-section :title="'日期用法:' + single" type="line"></uni-section>
5-
<view class="example-body">
5+
<view class="example-body" style="margin-left: 500px;">
66
<uni-datetime-picker type="date" :value="single" start="2021-3-20" end="2021-6-20" @change="change" @maskClick="maskClick" />
77
</view>
88
<uni-section :title="'时间戳用法:' + single" type="line"></uni-section>
@@ -35,7 +35,7 @@
3535
rangeSeparator="至" />
3636
</view>
3737
<uni-section :title="'日期时间范围用法:' + '[' + datetimerange + ']' " type="line"></uni-section>
38-
<view class="example-body">
38+
<view class="example-body" style="margin-left: 500px;">
3939
<uni-datetime-picker v-model="datetimerange" type="datetimerange" rangeSeparator="至" />
4040
</view>
4141
</view>

pages/vue/datetime-picker/datetime-picker.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<view class="page">
33
<text class="example-info">可以同时选择日期和时间的选择器</text>
44
<uni-section :title="'日期用法:' + single" type="line"></uni-section>
5-
<view class="example-body">
5+
<view class="example-body" style="margin-left: 500px;">
66
<uni-datetime-picker type="date" :value="single" start="2021-3-20" end="2021-6-20" @change="change" @maskClick="maskClick" />
77
</view>
88
<uni-section :title="'时间戳用法:' + single" type="line"></uni-section>
@@ -35,7 +35,7 @@
3535
rangeSeparator="" />
3636
</view>
3737
<uni-section :title="'日期时间范围用法:' + '[' + datetimerange + ']' " type="line"></uni-section>
38-
<view class="example-body">
38+
<view class="example-body" style="margin-left: 500px;">
3939
<uni-datetime-picker v-model="datetimerange" type="datetimerange" rangeSeparator="" />
4040
</view>
4141
</view>

uni_modules/uni-datetime-picker/changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.0.10(2021-07-08)
2+
- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug
3+
- 优化 弹出层在超出视窗边缘被遮盖的问题
14
## 2.0.9(2021-07-07)
25
- 新增 maskClick 事件
36
- 修复 特殊情况日历 rpx 布局错误的 bug,rpx -> px

uni_modules/uni-datetime-picker/components/uni-datetime-picker/calendar-item.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,15 @@
155155
156156
.uni-calendar-item--multiple .uni-calendar-item--before-checked {
157157
background-color: #409eff;
158-
color: #fff;
158+
color: #fff !important;
159159
// border-radius: 50%;
160160
box-sizing: border-box;
161161
border: 6px solid #f2f6fc;
162162
}
163163
164164
.uni-calendar-item--multiple .uni-calendar-item--after-checked {
165165
background-color: #409eff;;
166-
color: #fff;
166+
color: #fff !important;
167167
// border-radius: 50%;
168168
box-sizing: border-box;
169169
border: 6px solid #f2f6fc;

uni_modules/uni-datetime-picker/components/uni-datetime-picker/uni-datetime-picker.vue

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<view class="uni-date">
3-
<view @click="show">
3+
<view class="uni-date-editor" @click="show">
44
<slot>
55
<view class="uni-date-editor--x" :class="{'uni-date-editor--x__disabled': disabled,
66
'uni-date-x--border': border}">
@@ -327,6 +327,10 @@
327327
start: this.caleRange.startTime,
328328
end: this.caleRange.endTime
329329
}
330+
},
331+
datePopupWidth() {
332+
// todo
333+
return this.isRange ? 653 : 301
330334
}
331335
},
332336
mounted() {
@@ -370,20 +374,12 @@
370374
this.popover = {
371375
top: '10px'
372376
}
373-
// const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor--x")
374-
// dateEditor.boundingClientRect(rect => {
375-
// console.log(22222222, rect);
376-
// if (leftWindowInfo.errMsg) {
377-
// left = rect.left + 'px'
378-
// } else {
379-
// left = '15px'
380-
// }
381-
// this.popover = {
382-
// // top: rect.top + rect.height + 15 + 'px',
383-
// top: '40px',
384-
// left: 0,
385-
// }
386-
// }).exec()
377+
const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor")
378+
dateEditor.boundingClientRect(rect => {
379+
if (systemInfo.windowWidth - rect.left < this.datePopupWidth) {
380+
this.popover.left = `${systemInfo.windowWidth - rect.left - this.datePopupWidth - 20}px`
381+
}
382+
}).exec()
387383
setTimeout(() => {
388384
this.popup = !this.popup
389385
// this.visible = true
@@ -393,8 +389,8 @@
393389
close() {
394390
setTimeout(() => {
395391
this.popup = false
396-
// this.visible = true
397-
this.$emit('maskClick', this.value)
392+
// this.visible = true
393+
this.$emit('maskClick', this.value)
398394
}, 20)
399395
},
400396
setEmit(value) {
@@ -453,7 +449,6 @@
453449
fulldate: e.fulldate
454450
}
455451
this.startMultipleStatus = Object.assign({}, this.startMultipleStatus, obj)
456-
// console.log('startMultipleStatus 返回:', this.startMultipleStatus)
457452
},
458453
459454
rightChange(e) {
@@ -469,7 +464,6 @@
469464
fulldate: e.fulldate
470465
}
471466
this.endMultipleStatus = Object.assign({}, this.endMultipleStatus, obj)
472-
// console.log('endMultipleStatus 返回:', this.endMultipleStatus)
473467
},
474468
475469
mobileChange(e) {
@@ -712,8 +706,8 @@
712706
padding: 0 8px;
713707
background-color: #fff;
714708
position: absolute;
715-
top: 0;
716-
left: 0;
709+
top: 110;
710+
left: 110;
717711
z-index: 999;
718712
/* width: 733px; */
719713
border: 1px solid #e4e7ed;

uni_modules/uni-datetime-picker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "uni-datetime-picker",
33
"displayName": "uni-datetime-picker 日期选择器",
4-
"version": "2.0.9",
4+
"version": "2.0.10",
55
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
66
"keywords": [
77
"uni-datetime-picker",

0 commit comments

Comments
 (0)