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: {
|
methods: {
|
||||||
// @exposed-api
|
// @exposed-api
|
||||||
getPicker() {
|
getPicker() {
|
||||||
return this.$refs.root.getPicker();
|
return this.$refs.root.getProxiedPicker();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -60,27 +60,43 @@ export const TimePickerMixin = {
|
|||||||
if (!oldVal) {
|
if (!oldVal) {
|
||||||
this.$emit('input', null);
|
this.$emit('input', null);
|
||||||
} else {
|
} else {
|
||||||
this.$emit('input', val)
|
this.$emit('input', val);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
this.updateColumnValue();
|
this.updateColumnValue();
|
||||||
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.updateInnerValue();
|
this.updateInnerValue();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
// @exposed-api
|
|
||||||
getPicker() {
|
getPicker() {
|
||||||
return this.$refs.picker;
|
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() {
|
onConfirm() {
|
||||||
this.$emit('input', this.innerValue)
|
this.$emit('input', this.innerValue);
|
||||||
this.$emit('confirm', this.innerValue);
|
this.$emit('confirm', this.innerValue);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user