mirror of https://github.com/ElemeFE/element
TimeSelect: fix resetField not working when user inputs an invalid value (#10176)
parent
c48a69c947
commit
b24a9ce729
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue