From 28706df7da34b8854cdce96ad89c035eaded6ea9 Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期三, 09 四月 2025 15:54:50 +0800 Subject: [PATCH] 完善数字人 --- src/directive/customDirective.ts | 23 ++++++++++++++++++----- 1 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/directive/customDirective.ts b/src/directive/customDirective.ts index 5a13bdd..30e025e 100644 --- a/src/directive/customDirective.ts +++ b/src/directive/customDirective.ts @@ -11,17 +11,17 @@ el.classList.add('waves-effect'); binding.value && el.classList.add(`waves-${binding.value}`); function setConvertStyle(obj: { [key: string]: unknown }) { - let style: string = ''; - for (let i in obj) { + let style = ''; + for (const i in obj) { if (obj.hasOwnProperty(i)) style += `${i}:${obj[i]};`; } return style; } function onCurrentClick(e: { [key: string]: unknown }) { - let elDiv = document.createElement('div'); + const elDiv = document.createElement('div'); elDiv.classList.add('waves-ripple'); el.appendChild(elDiv); - let styles = { + const styles = { left: `${e.layerX}px`, top: `${e.layerY}px`, opacity: 1, @@ -125,7 +125,7 @@ } function move(e: any, type: string, obj: any) { - let { disX, disY, minDragDomLeft, maxDragDomLeft, minDragDomTop, maxDragDomTop, styL, styT } = obj; + const { disX, disY, minDragDomLeft, maxDragDomLeft, minDragDomTop, maxDragDomTop, styL, styT } = obj; // 閫氳繃浜嬩欢濮旀墭锛岃绠楃Щ鍔ㄧ殑璺濈 let left = type === 'pc' ? e.clientX - disX : e.touches[0].clientX - disX; @@ -218,3 +218,16 @@ }; //#endregion +//#region ====================== v-focus鎸囦护 ====================== +export const focusDirective = (app: App) => { + app.directive('focus', { + mounted: function (el) { + // 鐢变簬el-input鏄竴涓粍浠讹紝闇�瑕佹壘鍒板唴閮ㄧ殑input鍏冪礌 + const inputEl = el.querySelector('input'); + if (inputEl) { + inputEl.focus(); + } + }, + }); +}; +//#endregion -- Gitblit v1.9.3