Skip to content

Commit 17d2262

Browse files
committed
feat: add calendar-change event (#432)
1 parent 2fb9e67 commit 17d2262

File tree

3 files changed

+28
-24
lines changed

3 files changed

+28
-24
lines changed

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,19 @@ set fixed time list to select;
266266

267267
### Events
268268

269-
| Name | Description | Callback Arguments |
270-
| ----------- | ------------------------------------ | -------------------------------------------- |
271-
| input | When the value change(v-model event) | date |
272-
| change | When the value change(same as input) | date, type(date, hour, minute, second, ampm) |
273-
| open | When panel opening | |
274-
| close | When panel closing | |
275-
| confirm | When click 'confirm' button | date |
276-
| clear | When click 'clear' button | |
277-
| input-error | When user type a invalid Date | the input text |
278-
| focus | When input focus | |
279-
| blur | When input blur | |
280-
| pick | when select date [#429](issues/429) | date |
269+
| Name | Description | Callback Arguments |
270+
| --------------- | ------------------------------------ | -------------------------------------------- |
271+
| input | When the value change(v-model event) | date |
272+
| change | When the value change(same as input) | date, type(date, hour, minute, second, ampm) |
273+
| open | When panel opening | |
274+
| close | When panel closing | |
275+
| confirm | When click 'confirm' button | date |
276+
| clear | When click 'clear' button | |
277+
| input-error | When user type a invalid Date | the input text |
278+
| focus | When input focus | |
279+
| blur | When input blur | |
280+
| pick | when select date [#429](issues/429) | date |
281+
| calendar-change | when change the calendar | date, oldDate |
281282

282283
### Slots
283284

README.zh-CN.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,19 @@ data() {
263263

264264
### 事件
265265

266-
| 名称 | 描述 | 回调函数的参数 |
267-
| ----------- | ------------------------------- | -------------------------------------------- |
268-
| input | 当选择日期的事件触发 | date |
269-
| change | 当选择日期的事件触发 | date, type(date, hour, minute, second, ampm) |
270-
| open | 当弹出层打开时候 | |
271-
| close | 当弹出层关闭时候 | |
272-
| confirm | 当点击确认按钮 | date |
273-
| clear | 当点击清除按钮 | |
274-
| input-error | 当输入一个无效的时间 | 输入的值 |
275-
| focus | 当输入框有焦点 | |
276-
| blur | 当输入框失焦 | |
277-
| pick | 当点击日期时 [#429](issues/429) | date |
266+
| 名称 | 描述 | 回调函数的参数 |
267+
| --------------- | ------------------------------- | -------------------------------------------- |
268+
| input | 当选择日期的事件触发 | date |
269+
| change | 当选择日期的事件触发 | date, type(date, hour, minute, second, ampm) |
270+
| open | 当弹出层打开时候 | |
271+
| close | 当弹出层关闭时候 | |
272+
| confirm | 当点击确认按钮 | date |
273+
| clear | 当点击清除按钮 | |
274+
| input-error | 当输入一个无效的时间 | 输入的值 |
275+
| focus | 当输入框有焦点 | |
276+
| blur | 当输入框失焦 | |
277+
| pick | 当点击日期时 [#429](issues/429) | date |
278+
| calendar-change | 当改变年月时 | date, oldDate |
278279

279280
### Slots
280281

src/calendar/calendar-panel.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,10 @@ export default {
255255
}
256256
},
257257
updateCalendar(date) {
258+
const oldValue = new Date(this.innerCalendar);
258259
this.innerCalendar = date;
259260
this.$emit('update:calendar', date);
261+
this.dispatch('DatePicker', 'calendar-change', date, oldValue);
260262
},
261263
handelPanelChange(panel) {
262264
this.panel = panel;

0 commit comments

Comments
 (0)