From 6c7d33d16a776f67723009141ada363b4ea90744 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Tue, 2 Aug 2022 17:03:43 +0800 Subject: [PATCH 1/2] feat(gui-v2): SingleLineText Cell --- packages/nc-gui-v2/components/cell/Text.vue | 89 +++------------------ 1 file changed, 12 insertions(+), 77 deletions(-) diff --git a/packages/nc-gui-v2/components/cell/Text.vue b/packages/nc-gui-v2/components/cell/Text.vue index b1de025b8d..65fac3f5bc 100644 --- a/packages/nc-gui-v2/components/cell/Text.vue +++ b/packages/nc-gui-v2/components/cell/Text.vue @@ -1,100 +1,35 @@ - - + From 37e45ac53a05a1e5f101a59f75203d0e7cac2884 Mon Sep 17 00:00:00 2001 From: Wing-Kam Wong Date: Wed, 3 Aug 2022 13:08:15 +0800 Subject: [PATCH 2/2] 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() +}