Commit b24a9ce7 authored by Harlan's avatar Harlan Committed by 杨奕

TimeSelect: fix resetField not working when user inputs an invalid value (#10176)

parent c48a69c9
......@@ -502,6 +502,8 @@ export default {
gpuAcceleration: false
};
this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
this.$on('fieldReset', this.handleFieldReset);
},
methods: {
......@@ -634,6 +636,10 @@ export default {
this.pickerVisible = false;
},
handleFieldReset(initialValue) {
this.userInput = initialValue;
},
handleFocus() {
const type = this.type;
......
......@@ -6,8 +6,16 @@ export default {
name: 'ElTimeSelect',
componentName: 'ElTimeSelect',
props: {
type: {
type: String,
default: 'time-select'
}
},
beforeCreate() {
this.type = 'time-select';
this.panel = Panel;
}
};
......@@ -227,6 +227,8 @@
这里需要强行触发一次,刷新 validateDisabled 的值,
确保 Select 下一次值改变时能正确触发校验 */
this.broadcast('ElSelect', 'fieldReset');
this.broadcast('ElTimeSelect', 'fieldReset', this.initialValue);
},
getRules() {
let formRules = this.form.rules;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment