From aa1a4f90652876ec6873df74da850ae4b67fb205 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Mon, 1 Aug 2022 13:58:18 +0800 Subject: [PATCH] fix(gui-v2): focus on input & move keydown.enter to form --- .../nc-gui-v2/components/dlg/TableCreate.vue | 21 ++++++------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/packages/nc-gui-v2/components/dlg/TableCreate.vue b/packages/nc-gui-v2/components/dlg/TableCreate.vue index eb726c3a2e..864fa0ff5d 100644 --- a/packages/nc-gui-v2/components/dlg/TableCreate.vue +++ b/packages/nc-gui-v2/components/dlg/TableCreate.vue @@ -51,8 +51,10 @@ const validateDuplicate = (v: string) => { return (tables?.value || []).every((t) => t.table_name.toLowerCase() !== (v || '').toLowerCase()) || 'Duplicate table name' } -const inputEl = ref() +const inputEl = ref() + const useForm = Form.useForm + const validators = computed(() => { return { title: [validateTableName, validateDuplicateAlias], @@ -63,29 +65,18 @@ const { resetFields, validate, validateInfos } = useForm(table, validators) onMounted(() => { generateUniqueTitle() - - nextTick(() => { - const el = inputEl.value?.$el - el?.querySelector('input')?.focus() - el?.querySelector('input')?.select() - }) + inputEl.value?.focus() })