From 3be90604de82ef494e16bea7abda936013a7852a Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期四, 09 一月 2025 14:14:20 +0800 Subject: [PATCH] pingLogin --- src/directive/customDirective.ts | 19 ++++++++++++------- 1 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/directive/customDirective.ts b/src/directive/customDirective.ts index 525793c..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,13 +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