Skip to content

Commit 0c8951a

Browse files
committed
feat: date-picker ok calendar support string value
1 parent ff07ecd commit 0c8951a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

components/date-picker/wrapPicker.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ export default function wrapPicker(Picker, props, pickerType) {
115115
dateString,
116116
);
117117
},
118+
handleOk(val) {
119+
this.$emit('ok', this.valueFormat ? momentToString(val, this.valueFormat) : val);
120+
},
121+
handleCalendarChange(date, dateString) {
122+
this.$emit(
123+
'calendarChange',
124+
this.valueFormat ? momentToString(date, this.valueFormat) : date,
125+
dateString,
126+
);
127+
},
118128
focus() {
119129
this.$refs.picker.focus();
120130
},
@@ -208,6 +218,8 @@ export default function wrapPicker(Picker, props, pickerType) {
208218
mouseenter: this.handleMouseEnter,
209219
mouseleave: this.handleMouseLeave,
210220
change: this.handleChange,
221+
ok: this.handleOk,
222+
calendarChange: this.handleCalendarChange,
211223
},
212224
ref: 'picker',
213225
scopedSlots: this.$scopedSlots || {},

0 commit comments

Comments
 (0)