mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-08-23 20:39:45 +08:00
fix(DatetimePicker): should update value after calling picker methods (#10028)
This commit is contained in:
parent
29b1449977
commit
1d4c4df4fa
@ -13,7 +13,7 @@ export default createComponent({
|
||||
methods: {
|
||||
// @exposed-api
|
||||
getPicker() {
|
||||
return this.$refs.root.getPicker();
|
||||
return this.$refs.root.getProxiedPicker();
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -60,27 +60,43 @@ export const TimePickerMixin = {
|
||||
if (!oldVal) {
|
||||
this.$emit('input', null);
|
||||
} else {
|
||||
this.$emit('input', val)
|
||||
this.$emit('input', val);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.updateColumnValue();
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.updateInnerValue();
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
// @exposed-api
|
||||
getPicker() {
|
||||
return this.$refs.picker;
|
||||
},
|
||||
|
||||
// https://github.com/youzan/vant/issues/10013
|
||||
getProxiedPicker() {
|
||||
const { picker } = this.$refs;
|
||||
if (picker) {
|
||||
const proxy = (fn) => (...args) => {
|
||||
picker[fn](...args);
|
||||
this.updateInnerValue();
|
||||
};
|
||||
return {
|
||||
...picker,
|
||||
setValues: proxy('setValues'),
|
||||
setIndexes: proxy('setIndexes'),
|
||||
setColumnIndex: proxy('setColumnIndex'),
|
||||
setColumnValue: proxy('setColumnValue'),
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
onConfirm() {
|
||||
this.$emit('input', this.innerValue)
|
||||
this.$emit('input', this.innerValue);
|
||||
this.$emit('confirm', this.innerValue);
|
||||
},
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user