mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
fix(Form): loses focus on submit (#3796)
Co-authored-by: Romain Hamel <rom.hml@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b7fc69baa7
commit
8e78eb15c8
@@ -36,6 +36,12 @@ export interface FormProps<T extends object> {
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
transform?: boolean
|
||||
/**
|
||||
* When `true`, all form elements will be disabled on `@submit` event.
|
||||
* This will cause any focused input elements to lose their focus state.
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
loadingAuto?: boolean
|
||||
class?: any
|
||||
onSubmit?: ((event: FormSubmitEvent<T>) => void | Promise<void>) | (() => void | Promise<void>)
|
||||
}
|
||||
@@ -64,7 +70,8 @@ const props = withDefaults(defineProps<FormProps<T>>(), {
|
||||
return ['input', 'blur', 'change'] as FormInputEvents[]
|
||||
},
|
||||
validateOnInputDelay: 300,
|
||||
transform: true
|
||||
transform: true,
|
||||
loadingAuto: true
|
||||
})
|
||||
|
||||
const emits = defineEmits<FormEmits<T>>()
|
||||
@@ -213,7 +220,7 @@ const loading = ref(false)
|
||||
provide(formLoadingInjectionKey, readonly(loading))
|
||||
|
||||
async function onSubmitWrapper(payload: Event) {
|
||||
loading.value = true
|
||||
loading.value = props.loadingAuto && true
|
||||
|
||||
const event = payload as FormSubmitEvent<any>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user