element-plus/packages/hooks/use-focus/index.ts

14 lines
180 B
TypeScript
Raw Normal View History

import type { Ref } from 'vue'
export const useFocus = (
el: Ref<{
focus: () => void
} | null>
) => {
return {
focus: () => {
el.value?.focus?.()
},
}
}