gaoluyang
4 天以前 787ccc59ba89bacc075562a161ecf02bc76ebadc
src/views/im/home/components/card/card-line-label.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
<script lang="ts" setup>
import { computed } from 'vue'
import { IconifyIcon as Icon } from '#/packages/icons/src'
import { getCardLabelInfo } from '#/views/im/utils/message'
defineOptions({ name: 'ImCardLineLabel' })
const props = withDefaults(
  defineProps<{
    /** åç‰‡æ•°æ®ï¼›åªè¯» targetType / name æ´¾ç”Ÿæ ‡ç­¾ + æ˜¾ç¤ºï¼Œç»“构性类型兼容 CardMessage / å¼•用预览的 partial */
    card: null | undefined | { name?: string; targetType?: number; }
    iconSize?: number
  }>(),
  { iconSize: 14 }
)
/** æ ‡ç­¾ + å›¾æ ‡æŒ‰ targetType äºŒåˆ†ï¼›å…œåº•「个人名片」避免 null æ—¶ UI ç©ºç™½ */
const labelInfo = computed(() => getCardLabelInfo(props.card))
</script>
<template>
  <!-- åç‰‡å•行 inline label:「[icon] ç¾¤åç‰‡ / ä¸ªäººåç‰‡ï¼šxx」;列表摘要 / å¼•用预览 / åŽå°é¢„览复用 -->
  <span class="inline-flex gap-1.5 items-center">
    <Icon :icon="labelInfo.icon" :size="iconSize" />
    <span>{{ labelInfo.label }}:{{ card?.name || '' }}</span>
  </span>
</template>