Skip to content

Commit e57edac

Browse files
committed
优化 弹出层在超出视窗边缘定位不准确的问题
1 parent dc09874 commit e57edac

File tree

5 files changed

+9
-11
lines changed

5 files changed

+9
-11
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" style="margin-left: 500px;">
5+
<view class="example-body">
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" style="margin-left: 500px;">
38+
<view class="example-body">
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" style="margin-left: 500px;">
5+
<view class="example-body">
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" style="margin-left: 500px;">
38+
<view class="example-body">
3939
<uni-datetime-picker v-model="datetimerange" type="datetimerange" rangeSeparator="" />
4040
</view>
4141
</view>

uni_modules/uni-datetime-picker/changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
## 2.0.11(2021-07-08)
2+
- 优化 弹出层在超出视窗边缘定位不准确的问题
13
## 2.0.10(2021-07-08)
24
- 修复 范围起始点样式的背景色与今日样式的字体前景色融合,导致日期字体看不清的 bug
35
- 优化 弹出层在超出视窗边缘被遮盖的问题

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@
377377
const dateEditor = uni.createSelectorQuery().in(this).select(".uni-date-editor")
378378
dateEditor.boundingClientRect(rect => {
379379
if (systemInfo.windowWidth - rect.left < this.datePopupWidth) {
380-
this.popover.left = `${systemInfo.windowWidth - rect.left - this.datePopupWidth - 20}px`
380+
this.popover.right = 0
381381
}
382382
}).exec()
383383
setTimeout(() => {
@@ -694,9 +694,7 @@
694694
/* padding: 0 8px; */
695695
position: absolute;
696696
top: 0;
697-
left: 0;
698697
z-index: 999;
699-
/* width: 375px; */
700698
border: 1px solid #e4e7ed;
701699
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
702700
border-radius: 4px;
@@ -706,10 +704,8 @@
706704
padding: 0 8px;
707705
background-color: #fff;
708706
position: absolute;
709-
top: 110;
710-
left: 110;
707+
top: 0;
711708
z-index: 999;
712-
/* width: 733px; */
713709
border: 1px solid #e4e7ed;
714710
box-shadow: 0 2px 12px 0 rgb(0 0 0 / 10%);
715711
border-radius: 4px;

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.10",
4+
"version": "2.0.11",
55
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
66
"keywords": [
77
"uni-datetime-picker",

0 commit comments

Comments
 (0)