fix(user): 修正数量角标为数字时的显示逻辑

- 去除对 item.count 存在性的判断,改为直接将 count 转换为数字后判断
- 确保当 count 为字符串数字且大于0时角标正常显示
- 优化数量角标的渲染条件,提高代码健壮性
This commit is contained in:
2026-07-15 23:10:21 +08:00
parent 909e0fd43f
commit b8fca7bed2

View File

@@ -278,7 +278,7 @@ const UserPage: React.FC = () => {
<Text className='text-xl mb-1'>{item.icon}</Text>
<Text className='text-xs text-gray-600'>{item.label}</Text>
{/* 数量角标:紧贴图标右上角;为 0 时不渲染 */}
{item.count && Number(item.count) > 0 && (
{Number(item.count) > 0 && (
<View className='absolute -top-1 -right-1 bg-red-500 text-white rounded-full min-w-[16px] h-4 px-1 flex items-center justify-center' style={{ fontSize: '10px', lineHeight: '12px' }}>
{Number(item.count) > 99 ? '99+' : item.count}
</View>