mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Calendar): add close、closed event
This commit is contained in:
parent
e0c332a41f
commit
556f335cc2
@ -251,6 +251,8 @@ Set `poppable` to `false`, the calendar will be displayed directly on the page i
|
|||||||
|------|------|------|
|
|------|------|------|
|
||||||
| select | Triggered when select date | *value: Date \| Date[]* |
|
| select | Triggered when select date | *value: Date \| Date[]* |
|
||||||
| confirm | Triggered after date selection is complete,if `show-confirm` is` true`, it is triggered after clicking the confirm button | *value: Date \| Date[]* |
|
| confirm | Triggered after date selection is complete,if `show-confirm` is` true`, it is triggered after clicking the confirm button | *value: Date \| Date[]* |
|
||||||
|
| close `v2.5.2` | Triggered when close Calendar Popup | - |
|
||||||
|
| closed `v2.5.2` | Triggered when closed Calendar Popup | - |
|
||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
|
@ -253,6 +253,8 @@ export default {
|
|||||||
|------|------|------|
|
|------|------|------|
|
||||||
| select | 点击任意日期时触发 | *value: Date \| Date[]* |
|
| select | 点击任意日期时触发 | *value: Date \| Date[]* |
|
||||||
| confirm | 日期选择完成后触发,若`show-confirm`为`true`,则点击确认按钮后触发 | *value: Date \| Date[]* |
|
| confirm | 日期选择完成后触发,若`show-confirm`为`true`,则点击确认按钮后触发 | *value: Date \| Date[]* |
|
||||||
|
| close `v2.5.2` | 关闭弹出层时触发 | - |
|
||||||
|
| closed `v2.5.2` | 关闭弹出层且动画结束后触发 | - |
|
||||||
|
|
||||||
### Slots
|
### Slots
|
||||||
|
|
||||||
|
@ -373,6 +373,8 @@ export default createComponent({
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.poppable) {
|
if (this.poppable) {
|
||||||
|
const createListener = name => () => this.$emit(name);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Popup
|
<Popup
|
||||||
round
|
round
|
||||||
@ -385,6 +387,8 @@ export default createComponent({
|
|||||||
closeOnPopstate={this.closeOnPopstate}
|
closeOnPopstate={this.closeOnPopstate}
|
||||||
closeOnClickOverlay={this.closeOnClickOverlay}
|
closeOnClickOverlay={this.closeOnClickOverlay}
|
||||||
onInput={this.togglePopup}
|
onInput={this.togglePopup}
|
||||||
|
onClose={createListener('close')}
|
||||||
|
onClosed={createListener('closed')}
|
||||||
>
|
>
|
||||||
{this.genCalendar()}
|
{this.genCalendar()}
|
||||||
</Popup>
|
</Popup>
|
||||||
|
@ -450,3 +450,14 @@ test('max-range prop', async () => {
|
|||||||
|
|
||||||
expect(wrapper.emitted('confirm')).toBeFalsy();
|
expect(wrapper.emitted('confirm')).toBeFalsy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('close event', () => {
|
||||||
|
const wrapper = mount(Calendar, {
|
||||||
|
propsData: {
|
||||||
|
value: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
wrapper.setProps({ value: false });
|
||||||
|
expect(wrapper.emitted('close')).toBeTruthy();
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user