From 37e45ac53a05a1e5f101a59f75203d0e7cac2884 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 3 Aug 2022 13:08:15 +0800 Subject: [PATCH] refactor(gui-v2): use onSetRef --- packages/nc-gui-v2/components/cell/Text.vue | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/packages/nc-gui-v2/components/cell/Text.vue b/packages/nc-gui-v2/components/cell/Text.vue index 65fac3f5bc..653842a105 100644 --- a/packages/nc-gui-v2/components/cell/Text.vue +++ b/packages/nc-gui-v2/components/cell/Text.vue @@ -15,20 +15,13 @@ const root = ref() const vModel = useVModel(props, 'modelValue', emits) -onMounted(() => { - root.value?.focus() -}) - -watch( - () => root.value, - (el) => { - el?.focus() - }, -) +const onSetRef = (el: HTMLInputElement) => { + el.focus() +}