From e2f024763a1b0b356a29d20c5d4f29d291905517 Mon Sep 17 00:00:00 2001
From: hujinbin <437044048@qq.com>
Date: Tue, 26 Nov 2024 15:39:58 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A4=B4=E5=83=8F=E5=92=8C=E5=90=8D?=
=?UTF-8?q?=E5=AD=97=E4=B8=8D=E7=BB=9F=E4=B8=80=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/hooks/useElement.ts | 2 +-
src/style/style.scss | 16 ++++++----------
src/types/storeType.ts | 1 +
src/views/Home/index.vue | 12 +++++-------
4 files changed, 13 insertions(+), 18 deletions(-)
diff --git a/src/hooks/useElement.ts b/src/hooks/useElement.ts
index 35c92d5..e499e59 100644
--- a/src/hooks/useElement.ts
+++ b/src/hooks/useElement.ts
@@ -48,7 +48,7 @@ export const useElementStyle = (element: any, person: IPersonConfig, index: numb
if (person.department || person.identity) {
element.children[2].innerHTML = `${person.department ? person.department : ''}
${person.identity ? person.identity : ''}`
}
-
+ element.children[3].src = person.avatar
return element
}
diff --git a/src/style/style.scss b/src/style/style.scss
index d15d603..e63c306 100644
--- a/src/style/style.scss
+++ b/src/style/style.scss
@@ -36,11 +36,9 @@
right: 0;
bottom: 0;
z-index: 1;
- img {
- width: 140px !important;
- height: auto !important;
- object-fit: cover;
- }
+ width: 140px !important;
+ height: auto !important;
+ object-fit: cover;
}
}
@@ -90,10 +88,8 @@
right: 0;
bottom: 0;
z-index: 1;
- img {
- width: 280px !important;
- height: auto !important;
- object-fit: cover;
- }
+ width: 280px !important;
+ height: auto !important;
+ object-fit: cover;
}
}
diff --git a/src/types/storeType.ts b/src/types/storeType.ts
index 9ab7682..50e4c01 100644
--- a/src/types/storeType.ts
+++ b/src/types/storeType.ts
@@ -4,6 +4,7 @@ export interface IPersonConfig {
name: string;
department: string;
identity: string;
+ avatar: string;
isWin: boolean;
x: number;
y: number
diff --git a/src/views/Home/index.vue b/src/views/Home/index.vue
index f208361..1e223b2 100644
--- a/src/views/Home/index.vue
+++ b/src/views/Home/index.vue
@@ -131,14 +131,12 @@ const init = () => {
detail.innerHTML = `${tableData.value[i].department}
${tableData.value[i].identity}`;
element.appendChild(detail);
- const avatar = document.createElement('div');
+ const avatar = document.createElement('img');
avatar.className = 'card-avatar';
- const img = document.createElement('img');
- img.src = tableData.value[i].avatar;
- img.alt = 'avatar';
- img.style.width = '140px';
- img.style.height = '140px';
- avatar.appendChild(img);
+ avatar.src = tableData.value[i].avatar;
+ avatar.alt = 'avatar';
+ avatar.style.width = '140px';
+ avatar.style.height = '140px';
element.appendChild(avatar);
element = useElementStyle(element, tableData.value[i], i, patternList.value, patternColor.value, cardColor.value, cardSize.value, textSize.value)