Browse Source

refactor(gui-v2): use onSetRef

pull/2960/head
Wing-Kam Wong 2 years ago
parent
commit
fa11ac70c4
  1. 19
      packages/nc-gui-v2/components/cell/TextArea.vue

19
packages/nc-gui-v2/components/cell/TextArea.vue

@ -11,26 +11,17 @@ const emits = defineEmits(['update:modelValue'])
const editEnabled = inject<boolean>('editEnabled', false)
const root = ref<HTMLInputElement>()
const vModel = useVModel(props, 'modelValue', emits)
onMounted(() => {
root.value?.focus()
})
watch(
() => root.value,
(el) => {
el?.focus()
},
)
const onSetRef = (el: HTMLInputElement) => {
el.focus()
}
</script>
<template>
<textarea
v-if="editEnabled"
ref="root"
:ref="onSetRef"
v-model="vModel"
rows="4"
class="h-full w-full min-h-[60px] outline-none"
@ -44,4 +35,4 @@ watch(
textarea:focus {
@apply ring-transparent;
}
</style>
</style>
Loading…
Cancel
Save