Skip to content

Commit 45969a1

Browse files
committed
feat: add event update:show-time-panel (#531)
1 parent a5a4109 commit 45969a1

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

src/date-picker.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -482,9 +482,11 @@ export default {
482482
...pick(this.$props, Object.keys(Component.props)),
483483
value: this.currentValue,
484484
};
485-
const content = (
486-
<Component {...{ props, on: { select: this.handleSelectDate }, ref: 'picker' }} />
487-
);
485+
const on = {
486+
...pick(this.$listeners, Component.emits || []),
487+
select: this.handleSelectDate,
488+
};
489+
const content = <Component {...{ props, on, ref: 'picker' }} />;
488490
return (
489491
<div class={`${this.prefixClass}-datepicker-body`}>
490492
{this.renderSlot('content', content, {

src/datetime/datetime-panel.js

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default {
1010
default: 'mx',
1111
},
1212
},
13+
emits: ['select', 'update:show-time-panel'],
1314
props: {
1415
...CalendarPanel.props,
1516
...TimePanel.props,
@@ -33,6 +34,9 @@ export default {
3334
value(val) {
3435
this.currentValue = val;
3536
},
37+
defaultTimeVisible(val) {
38+
this.$emit('update:show-time-panel', val);
39+
},
3640
},
3741
methods: {
3842
closeTimePanel() {

src/datetime/datetime-range.js

+4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export default {
1010
default: 'mx',
1111
},
1212
},
13+
emits: ['select', 'update:show-time-panel'],
1314
props: {
1415
...CalendarRange.props,
1516
...TimeRange.props,
@@ -33,6 +34,9 @@ export default {
3334
value(val) {
3435
this.currentValue = val;
3536
},
37+
defaultTimeVisible(val) {
38+
this.$emit('update:show-time-panel', val);
39+
},
3640
},
3741
methods: {
3842
closeTimePanel() {

0 commit comments

Comments
 (0)