Skip to content

Commit 2428a83

Browse files
committed
fix:
- uni-countdown 修复 组件名导致引入错误的Bug - uni-calendar 修复 动态获取selected就会导致切换不了月份的Bug - uni-calendar 修复 选择月份不能点击的Bug - uni-calendar 修复 切换月份选中每月1号的Bug - uni-calendar 优化 日历视图样式,优化逻辑代码实现,使性能更好 - uni-calendar 添加 切换月份返回事件 - uni-grid 修复 子组件引入没使用的组件,导致报错的bug - uni-grid 修复 正方形宫格显示不正确的Bug - uni-grid 修复 动态数据不渲染的问题 - uni-grid 优化 用户可自定义宫格内容,如添加角标、红点、修改背景色等 - uni-list 优化 分割线为极细 - uni-load-more 优化 支持调整图标大小 - uni-popup 优化 更流畅的动画效果 - uni-popup 修复 点击蒙版关闭后,再次打开弹框失败的Bug - uni-popup 修复 type 值 为静态值时导致弹出层错误的Bug - uni-swipe-action 新增 nvue 页面使用bindingx实现跟手动画,性能提升 - uni-swipe-action 修复 autoClose 属性开启状态下滑动不正常的Bug - uni-swipe-action 优化 组件联动效果更流畅 - uni-swipe-action 新增 示例新增添加、删除效果实现 - uni-transition 新增 过渡动画组件
1 parent 8943742 commit 2428a83

File tree

47 files changed

+2612
-1068
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+2612
-1068
lines changed

components/uni-calendar/uni-calendar.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@
103103
aniMaskShow: false
104104
}
105105
},
106+
watch: {
107+
selected(newVal) {
108+
this.cale.setSelectInfo(this.nowDate.fullDate, newVal)
109+
this.weeks = this.cale.weeks
110+
}
111+
},
106112
created() {
107113
// 获取日历方法实例
108114
this.cale = new Calendar({
@@ -143,6 +149,16 @@
143149
if (!this.insert) return
144150
this.setEmit('change')
145151
},
152+
monthSwitch() {
153+
let {
154+
year,
155+
month
156+
} = this.nowDate
157+
this.$emit('monthSwitch', {
158+
year,
159+
month: Number(month)
160+
})
161+
},
146162
setEmit(name) {
147163
let {
148164
year,
@@ -179,11 +195,13 @@
179195
pre() {
180196
const preDate = this.cale.getDate(this.nowDate.fullDate, -1, 'month').fullDate
181197
this.setDate(preDate)
198+
this.monthSwitch()
182199
183200
},
184201
next() {
185202
const nextDate = this.cale.getDate(this.nowDate.fullDate, +1, 'month').fullDate
186203
this.setDate(nextDate)
204+
this.monthSwitch()
187205
},
188206
setDate(date) {
189207
this.cale.setDate(date)
@@ -361,5 +379,6 @@
361379
color: #999;
362380
opacity: 0.1;
363381
text-align: center;
382+
line-height: 1;
364383
}
365384
</style>

components/uni-calendar/util.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@ class Calendar {
99
range
1010
} = {}) {
1111
// 当前日期
12-
this.date = this.getDate(date) // 当前初入日期
12+
this.date = this.getDate(date) // 当前初入日期
1313
// 打点信息
1414
this.selected = selected || [];
1515
// 范围开始
1616
this.startDate = startDate
1717
// 范围结束
1818
this.endDate = endDate
1919
this.range = range
20-
// 多选状态
20+
// 多选状态
2121
this.multipleStatus = {
2222
before: '',
2323
after: '',
2424
data: []
2525
}
2626
// 每周日期
27-
this.weeks = {}
28-
27+
this.weeks = {}
28+
2929
this._getWeek(this.date.fullDate)
3030
}
3131

@@ -88,14 +88,14 @@ class Calendar {
8888
* 获取本月天数
8989
*/
9090
_currentMonthDys(dateData, full) {
91-
let dateArr = []
92-
let fullDate = this.date.fullDate
91+
let dateArr = []
92+
let fullDate = this.date.fullDate
9393
for (let i = 1; i <= dateData; i++) {
9494
let isinfo = false
9595
let nowDate = full.year + '-' + (full.month < 10 ?
9696
full.month : full.month) + '-' + (i < 10 ?
9797
'0' + i : i)
98-
// 是否今天
98+
// 是否今天
9999
let isDay = fullDate === nowDate
100100
// 获取打点信息
101101
let info = this.selected && this.selected.find((item) => {
@@ -104,7 +104,7 @@ class Calendar {
104104
}
105105
})
106106

107-
// 日期禁用
107+
// 日期禁用
108108
let disableBefore = true
109109
let disableAfter = true
110110
if (this.startDate) {
@@ -135,7 +135,7 @@ class Calendar {
135135
fullDate: nowDate,
136136
year: full.year,
137137
date: i,
138-
multiple: this.range ? checked : false,
138+
multiple: this.range ? checked : false,
139139
month: full.month,
140140
lunar: this.getlunar(full.year, full.month, i),
141141
disable: !disableBefore || !disableAfter,
@@ -240,12 +240,13 @@ class Calendar {
240240
*/
241241
getlunar(year, month, date) {
242242
return CALENDAR.solar2lunar(year, month, date)
243-
}
243+
}
244244
/**
245245
* 设置打点
246246
*/
247-
setSelectInfo(data) {
248-
// console.log(data);
247+
setSelectInfo(data, value) {
248+
this.selected = value
249+
this._getWeek(data)
249250
}
250251

251252
/**

0 commit comments

Comments
 (0)