mirror of https://github.com/ElemeFE/element
DatePicker: add validate-event attribute (#13531)
parent
96d787dac9
commit
d8d4dfedd5
|
@ -495,6 +495,7 @@ When picking a date range, you can assign the time part for start date and end d
|
||||||
| unlink-panels | unlink two date-panels in range-picker | boolean | — | false |
|
| unlink-panels | unlink two date-panels in range-picker | boolean | — | false |
|
||||||
| prefix-icon | Custom prefix icon class | string | — | el-icon-date |
|
| prefix-icon | Custom prefix icon class | string | — | el-icon-date |
|
||||||
| clear-icon | Custom clear icon class | string | — | el-icon-circle-close |
|
| clear-icon | Custom clear icon class | string | — | el-icon-circle-close |
|
||||||
|
| validate-event | whether to trigger form validation | boolean | - | true |
|
||||||
|
|
||||||
### Picker Options
|
### Picker Options
|
||||||
| Attribute | Description | Type | Accepted Values | Default |
|
| Attribute | Description | Type | Accepted Values | Default |
|
||||||
|
|
|
@ -666,7 +666,7 @@ Search data from server-side.
|
||||||
|form | same as `form` in native input | string | — | — |
|
|form | same as `form` in native input | string | — | — |
|
||||||
| label | label text | string | — | — |
|
| label | label text | string | — | — |
|
||||||
| tabindex | input tabindex | string | - | - |
|
| tabindex | input tabindex | string | - | - |
|
||||||
| validate-event | whether to trigger form validation | boolean | - | - |
|
| validate-event | whether to trigger form validation | boolean | - | true |
|
||||||
|
|
||||||
### Input slots
|
### Input slots
|
||||||
|
|
||||||
|
|
|
@ -302,6 +302,7 @@ DateTimePicker se deriva de DatePicker y TimePicker. Por una explicación más d
|
||||||
| unlink-panels | desconectar dos date-panels en range-picker | boolean | — | false |
|
| unlink-panels | desconectar dos date-panels en range-picker | boolean | — | false |
|
||||||
| prefix-icon | Clase personalizada para el icono prefijado | string | — | el-icon-date |
|
| prefix-icon | Clase personalizada para el icono prefijado | string | — | el-icon-date |
|
||||||
| clear-icon | Clase personalizada para el icono `clear` | string | — | el-icon-circle-close |
|
| clear-icon | Clase personalizada para el icono `clear` | string | — | el-icon-circle-close |
|
||||||
|
| validate-event | whether to trigger form validation | boolean | - | true |
|
||||||
|
|
||||||
### Picker Options
|
### Picker Options
|
||||||
| Atributo | Descripción | Tipo | Valores aceptados | Por defecto |
|
| Atributo | Descripción | Tipo | Valores aceptados | Por defecto |
|
||||||
|
|
|
@ -704,7 +704,7 @@ Búsqueda de datos desde el servidor.
|
||||||
| suffix-icon | suffix icon class | string | — | — |
|
| suffix-icon | suffix icon class | string | — | — |
|
||||||
| hide-loading | si se debe ocultar el icono de loading en la búsqueda remota | boolean | — | false |
|
| hide-loading | si se debe ocultar el icono de loading en la búsqueda remota | boolean | — | false |
|
||||||
| popper-append-to-body | si añadir el desplegable al cuerpo. Si la posición del menú desplegable es incorrecta, puede intentar establecer este prop a false | boolean | - | true |
|
| popper-append-to-body | si añadir el desplegable al cuerpo. Si la posición del menú desplegable es incorrecta, puede intentar establecer este prop a false | boolean | - | true |
|
||||||
| validate-event | si se debe lanzar la validación de formulario | boolean | - | - |
|
| validate-event | si se debe lanzar la validación de formulario | boolean | - | true |
|
||||||
|
|
||||||
### Autocomplete Slots
|
### Autocomplete Slots
|
||||||
|
|
||||||
|
|
|
@ -450,6 +450,7 @@
|
||||||
| unlink-panels | 在范围选择器里取消两个日期面板之间的联动 | boolean | — | false |
|
| unlink-panels | 在范围选择器里取消两个日期面板之间的联动 | boolean | — | false |
|
||||||
| prefix-icon | 自定义头部图标的类名 | string | — | el-icon-date |
|
| prefix-icon | 自定义头部图标的类名 | string | — | el-icon-date |
|
||||||
| clear-icon | 自定义清空图标的类名 | string | — | el-icon-circle-close |
|
| clear-icon | 自定义清空图标的类名 | string | — | el-icon-circle-close |
|
||||||
|
| validate-event | 输入时是否触发表单的校验 | boolean | - | true |
|
||||||
|
|
||||||
### Picker Options
|
### Picker Options
|
||||||
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
| 参数 | 说明 | 类型 | 可选值 | 默认值 |
|
||||||
|
|
|
@ -822,7 +822,7 @@ export default {
|
||||||
| form | 原生属性 | string | — | — |
|
| form | 原生属性 | string | — | — |
|
||||||
| label | 输入框关联的label文字 | string | — | — |
|
| label | 输入框关联的label文字 | string | — | — |
|
||||||
| tabindex | 输入框的tabindex | string | - | - |
|
| tabindex | 输入框的tabindex | string | - | - |
|
||||||
| validate-event | 输入时是否触发表单的校验 | boolean | - | - |
|
| validate-event | 输入时是否触发表单的校验 | boolean | - | true |
|
||||||
|
|
||||||
### Input Slots
|
### Input Slots
|
||||||
| name | 说明 |
|
| name | 说明 |
|
||||||
|
|
|
@ -386,7 +386,11 @@ export default {
|
||||||
default: '-'
|
default: '-'
|
||||||
},
|
},
|
||||||
pickerOptions: {},
|
pickerOptions: {},
|
||||||
unlinkPanels: Boolean
|
unlinkPanels: Boolean,
|
||||||
|
validateEvent: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
components: { ElInput },
|
components: { ElInput },
|
||||||
|
@ -413,7 +417,9 @@ export default {
|
||||||
this.hidePicker();
|
this.hidePicker();
|
||||||
this.emitChange(this.value);
|
this.emitChange(this.value);
|
||||||
this.userInput = null;
|
this.userInput = null;
|
||||||
|
if (this.validateEvent) {
|
||||||
this.dispatch('ElFormItem', 'el.form.blur');
|
this.dispatch('ElFormItem', 'el.form.blur');
|
||||||
|
}
|
||||||
this.$emit('blur', this);
|
this.$emit('blur', this);
|
||||||
this.blur();
|
this.blur();
|
||||||
}
|
}
|
||||||
|
@ -433,7 +439,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
value(val, oldVal) {
|
value(val, oldVal) {
|
||||||
if (!valueEquals(val, oldVal) && !this.pickerVisible) {
|
if (!valueEquals(val, oldVal) && !this.pickerVisible && this.validateEvent) {
|
||||||
this.dispatch('ElFormItem', 'el.form.change', val);
|
this.dispatch('ElFormItem', 'el.form.change', val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -897,8 +903,10 @@ export default {
|
||||||
// determine user real change only
|
// determine user real change only
|
||||||
if (!valueEquals(val, this.valueOnOpen)) {
|
if (!valueEquals(val, this.valueOnOpen)) {
|
||||||
this.$emit('change', val);
|
this.$emit('change', val);
|
||||||
this.dispatch('ElFormItem', 'el.form.change', val);
|
|
||||||
this.valueOnOpen = val;
|
this.valueOnOpen = val;
|
||||||
|
if (this.validateEvent) {
|
||||||
|
this.dispatch('ElFormItem', 'el.form.change', val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue