Files
todo-frontend/src/components/Icon.vue
Agent 4539be1559
All checks were successful
continuous-integration/drone/push Build is passing
fix: 背景改为浅白色,图标改为更清晰的样式,卡片改为浅色系
2026-03-28 12:59:02 +00:00

70 lines
1.3 KiB
Vue
Raw 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>
<view class="icon-wrapper" :style="iconStyle">
<text class="icon-text">{{ iconChar }}</text>
</view>
</template>
<script>
// 简单图标映射
const icons = {
home: '🏠',
user: '👤',
chart: '📊',
product: '📦',
add: '',
search: '🔍',
order: '📋',
edit: '✏️',
check: '✓',
close: '✕',
stock: '🏭',
alert: '⚡',
in: '⬇️',
out: '⬆️',
customer: '👥',
money: '💰',
logout: '↩️',
right: '',
left: '',
down: '▼',
lock: '🔐',
calendar: '📅',
setting: '⚙️',
wechat: '💬',
cash: '💵',
alipay: '💙',
plus: '📥',
flow: '📊'
}
export default {
name: 'Icon',
props: {
name: { type: String, required: true },
size: { type: [Number, String], default: 32 },
color: { type: String, default: '' }
},
computed: {
iconStyle() {
const style = {}
if (this.size) style.fontSize = typeof this.size === 'number' ? `${this.size}rpx` : this.size
if (this.color) style.color = this.color
return style
},
iconChar() {
return icons[this.name] || '•'
}
}
}
</script>
<style>
.icon-wrapper {
display: flex;
align-items: center;
justify-content: center;
}
.icon-text {
line-height: 1;
}
</style>