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 { ...@@ -502,6 +502,8 @@ export default {
gpuAcceleration: false gpuAcceleration: false
}; };
this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left; this.placement = PLACEMENT_MAP[this.align] || PLACEMENT_MAP.left;
this.$on('fieldReset', this.handleFieldReset);
}, },
methods: { methods: {
...@@ -634,6 +636,10 @@ export default { ...@@ -634,6 +636,10 @@ export default {
this.pickerVisible = false; this.pickerVisible = false;
}, },
handleFieldReset(initialValue) {
this.userInput = initialValue;
},
handleFocus() { handleFocus() {
const type = this.type; const type = this.type;
......
...@@ -6,8 +6,16 @@ export default { ...@@ -6,8 +6,16 @@ export default {
name: 'ElTimeSelect', name: 'ElTimeSelect',
componentName: 'ElTimeSelect',
props: {
type: {
type: String,
default: 'time-select'
}
},
beforeCreate() { beforeCreate() {
this.type = 'time-select';
this.panel = Panel; this.panel = Panel;
} }
}; };
...@@ -227,6 +227,8 @@ ...@@ -227,6 +227,8 @@
这里需要强行触发一次,刷新 validateDisabled 的值, 这里需要强行触发一次,刷新 validateDisabled 的值,
确保 Select 下一次值改变时能正确触发校验 */ 确保 Select 下一次值改变时能正确触发校验 */
this.broadcast('ElSelect', 'fieldReset'); this.broadcast('ElSelect', 'fieldReset');
this.broadcast('ElTimeSelect', 'fieldReset', this.initialValue);
}, },
getRules() { getRules() {
let formRules = this.form.rules; 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