From c1b0754e4230a02f80502a7f0c16bfc4f86911b0 Mon Sep 17 00:00:00 2001 From: heixinyouzi <2410633923@qq.com> Date: Thu, 6 Jun 2024 16:00:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E8=88=AAico=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/home/navMenu.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/views/home/navMenu.vue b/src/views/home/navMenu.vue index dfd818a..0b6e521 100644 --- a/src/views/home/navMenu.vue +++ b/src/views/home/navMenu.vue @@ -6,7 +6,10 @@ <div class="card hover:shadow-[0px_0px_5px_1px_#8A2BE2] mr-4 mb-4 rounded-md py-4 flex justify-center items-center w-[320px] bg-[#f2e8fc]" @click="link(it.menuLink)" v-for="(it, idx) in item.children" :key="index"> <div class="left mr-3"> - <img width="40" height="40" class="rounded-full bg-[white]" :src="it.menuIcon" alt=""> + <img v-if="it.isHaveIco" width="40" height="40" class="rounded-full bg-[white]" :src="it.menuIcon" alt="" @error="it.isHaveIco=false"> + <div v-else class="w-[40px] h-[40px] flex justify-center items-center rounded-full bg-[white] font-bold text-2xl text-orange-500"> + {{ it.menuName.slice(0,1) }} + </div> </div> <div class="right w-[224px]"> <div class="text-[20px] text-pp-700 font-bold">{{ it.menuName }}</div> @@ -33,11 +36,14 @@ import { onMounted } from 'vue'; //mark data const navList = ref([]) +const isHaveIco = ref(true) + //mark method function formatNav(list) { let menu = [] let result = [] list.forEach(i => { + i.isHaveIco = true if (!menu.includes(i.menuClass)) { menu.push(i.menuClass) }