Files
akmon/components/simple-icon/simple-icon.uvue
2026-01-20 08:04:15 +08:00

74 lines
1.3 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<text class="simple-icon" :style="iconStyle">{{ iconText }}</text>
</template>
<script setup lang="uts">
const props = defineProps<{
type: string;
size?: number | null;
color?: string | null;
}>()
const iconMap = {
// 基本图标
'plus': '+',
'minus': '-',
'close': '×',
'closeempty': '×',
'checkmarkempty': '✓',
'check': '✓',
'right': '→',
'left': '←',
'up': '↑',
'down': '↓',
// 媒体图标
'play-filled': '▶',
'pause-filled': '⏸',
'stop': '⏹',
'refresh': '↻',
// 功能图标
'home': '⌂',
'person': '👤',
'chat': '💬',
'list': '☰',
'bars': '☰',
'calendar': '📅',
'clock': '🕐',
'info': '',
'help': '?',
'trash': '🗑',
'compose': '✏',
'videocam': '📹',
// 体育分析相关图标
'file': '📄',
'trophy': '🏆',
'star': '⭐',
'bell': '🔔',
// 默认
'default': '•'
}
const iconText = computed(() => {
return (iconMap[props.type] ?? iconMap['default']) as any
})
const iconStyle = computed(() => {
return {
fontSize: `${props.size}px`,
color: props.color,
fontFamily: 'system-ui, -apple-system, sans-serif'
}
})
</script>
<style scoped>
.simple-icon {
text-align: center;
line-height: 1;
}
</style>