@forelse($users as $index => $user) @php // 前三名前景色 $rankBg = 'bg-gray-100 text-gray-500'; $rowBg = 'hover:bg-gray-50'; if ($index === 0) { $rankBg = 'bg-yellow-400 text-yellow-900 shadow-md transform scale-110'; $rowBg = 'bg-yellow-50 hover:bg-yellow-100 border-l-4 border-yellow-400'; } elseif ($index === 1) { $rankBg = 'bg-gray-300 text-gray-800 shadow-sm transform scale-105'; $rowBg = 'bg-gray-50 hover:bg-gray-100 border-l-4 border-gray-300'; } elseif ($index === 2) { $rankBg = 'bg-orange-300 text-orange-900 shadow-sm'; $rowBg = 'bg-orange-50 hover:bg-orange-100 border-l-4 border-orange-300'; } @endphp @if ($user)
  • {{ $index + 1 }}
    {{ $user->username }} @if ($user->sex == '女') ♀ @elseif($user->sex == '男') ♂ @endif 暂无个性签名
    {{ number_format($user->$valueField) }} {{ $unit }}
  • @endif @empty
  • 暂无数据登榜
  • @endforelse