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 | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/src/directive/customDirective.ts b/src/directive/customDirective.ts index c623e98..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) { @@ -202,3 +202,19 @@ }, }); }; + +export const eleFocusDirective = (app: App) => { + app.directive('elInputFocus', { + mounted: (el, binding: any) => { + const inputInner = el.querySelector('input.el-input__inner'); + inputInner?.focus(); + // 閫変腑 input 涓殑鎵�鏈夊唴瀹� + // 鍒ゆ柇鏄惁缁戝畾鍊兼湁瑕侀�変腑 + if (binding.value) { + nextTick(() => { + inputInner?.select(); + }); + } + }, + }); +}; -- Gitblit v1.9.3