Files
orion-visor/orion-visor-ui/src/utils/dom.ts

11 lines
251 B
TypeScript
Raw Normal View History

2024-12-16 23:20:57 +08:00
import type { VNodeRef } from 'vue';
2024-02-20 00:06:10 +08:00
import { nextTick } from 'vue';
// 设置 ref 自动聚焦
2024-12-16 23:20:57 +08:00
export const setAutoFocus: VNodeRef = ((el: HTMLElement) => {
2024-02-20 00:06:10 +08:00
// 自动聚焦
nextTick(() => {
el && el.focus();
});
2024-12-16 23:20:57 +08:00
}) as unknown as VNodeRef;