From abb2d585e04023a018095e69a30830e320d63d9e Mon Sep 17 00:00:00 2001 From: yangyin <18723093654@163.com> Date: 星期四, 12 十二月 2024 11:24:52 +0800 Subject: [PATCH] 新增测试工作流 --- src/directive/customDirective.ts | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/directive/customDirective.ts b/src/directive/customDirective.ts index ca1f987..a62d939 100644 --- a/src/directive/customDirective.ts +++ b/src/directive/customDirective.ts @@ -1,4 +1,4 @@ -import type { App } from 'vue'; +import { nextTick, type App } from 'vue'; const map = new WeakMap(); const ob = new ResizeObserver((entries) => { for (const entry of entries) { @@ -203,12 +203,18 @@ }); }; - - export const eleFocusDirective = (app: App) => { app.directive('elInputFocus', { - mounted: (el) => { - el.querySelector('input.el-input__inner')?.focus(); + mounted: (el, binding: any) => { + const inputInner = el.querySelector('input.el-input__inner'); + inputInner?.focus(); + // 閫変腑 input 涓殑鎵�鏈夊唴瀹� + // 鍒ゆ柇鏄惁缁戝畾鍊兼湁瑕侀�変腑 + if (binding.value) { + nextTick(() => { + inputInner?.select(); + }); + } }, }); -}; \ No newline at end of file +}; -- Gitblit v1.9.3