Skip to content

Commit

Permalink
feat: add event update:show-time-panel (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
mengxiong10 committed Nov 16, 2020
1 parent a5a4109 commit 45969a1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/date-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,11 @@ export default {
...pick(this.$props, Object.keys(Component.props)),
value: this.currentValue,
};
const content = (
<Component {...{ props, on: { select: this.handleSelectDate }, ref: 'picker' }} />
);
const on = {
...pick(this.$listeners, Component.emits || []),
select: this.handleSelectDate,
};
const content = <Component {...{ props, on, ref: 'picker' }} />;
return (
<div class={`${this.prefixClass}-datepicker-body`}>
{this.renderSlot('content', content, {
Expand Down
4 changes: 4 additions & 0 deletions src/datetime/datetime-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default {
default: 'mx',
},
},
emits: ['select', 'update:show-time-panel'],
props: {
...CalendarPanel.props,
...TimePanel.props,
Expand All @@ -33,6 +34,9 @@ export default {
value(val) {
this.currentValue = val;
},
defaultTimeVisible(val) {
this.$emit('update:show-time-panel', val);
},
},
methods: {
closeTimePanel() {
Expand Down
4 changes: 4 additions & 0 deletions src/datetime/datetime-range.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default {
default: 'mx',
},
},
emits: ['select', 'update:show-time-panel'],
props: {
...CalendarRange.props,
...TimeRange.props,
Expand All @@ -33,6 +34,9 @@ export default {
value(val) {
this.currentValue = val;
},
defaultTimeVisible(val) {
this.$emit('update:show-time-panel', val);
},
},
methods: {
closeTimePanel() {
Expand Down

0 comments on commit 45969a1

Please sign in to comment.