gaoluyang
2026-06-24 712aa51536236d43e87273e4ce45ac5691dffad8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<script setup lang="ts">
import type { MenuGridProperty } from './config';
 
import { Image } from 'ant-design-vue';
 
/** 宫格导航 */
defineOptions({ name: 'MenuGrid' });
 
defineProps<{ property: MenuGridProperty }>();
</script>
 
<template>
  <div class="flex flex-row flex-wrap">
    <div
      v-for="(item, index) in property.list"
      :key="index"
      class="relative flex flex-col items-center pb-4 pt-4"
      :style="{ width: `${100 * (1 / property.column)}%` }"
    >
      <!-- 右上角角标 -->
      <span
        v-if="item.badge?.show"
        class="absolute left-1/2 top-2 z-10 h-4 rounded-full px-2 text-center text-xs leading-5"
        :style="{
          color: item.badge.textColor,
          backgroundColor: item.badge.bgColor,
        }"
      >
        {{ item.badge.text }}
      </span>
      <Image
        v-if="item.iconUrl"
        :width="32"
        :src="item.iconUrl"
        :preview="false"
      />
      <span
        class="mt-2 h-4 text-xs leading-4"
        :style="{ color: item.titleColor }"
      >
        {{ item.title }}
      </span>
      <span
        class="mt-1.5 h-3 text-xs leading-3"
        :style="{ color: item.subtitleColor }"
      >
        {{ item.subtitle }}
      </span>
    </div>
  </div>
</template>