88 lines
1.8 KiB
Vue
Executable File
88 lines
1.8 KiB
Vue
Executable File
<template>
|
|
<div class="ranking-card" @click="handleClick">
|
|
<span class="rank-num" :class="{ 'top-three': index < 3 }">{{ index + 1 }}</span>
|
|
<img v-if="data.cover" :src="data.cover" class="rank-cover" />
|
|
<div class="rank-info">
|
|
<span class="rank-title">{{ data.title }}</span>
|
|
<span class="rank-count">🔍 {{ data.search_count }} 次搜索</span>
|
|
</div>
|
|
<CloudBadge :cloud_type="data.cloud_type" />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { useRouter } from 'vue-router'
|
|
import CloudBadge from './CloudBadge.vue'
|
|
import type { RankingItem } from '../types'
|
|
|
|
const props = defineProps<{
|
|
data: RankingItem
|
|
index: number
|
|
}>()
|
|
|
|
const router = useRouter()
|
|
|
|
function handleClick() {
|
|
router.push('/search?q=' + encodeURIComponent(props.data.title))
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.ranking-card {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 10px 12px;
|
|
background: var(--bg-white);
|
|
border-radius: 8px;
|
|
gap: 12px;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
}
|
|
.ranking-card:hover {
|
|
background: #f0f5ff;
|
|
}
|
|
.rank-num {
|
|
width: 24px;
|
|
height: 24px;
|
|
border-radius: 50%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--text-secondary);
|
|
background: #f0f0f0;
|
|
flex-shrink: 0;
|
|
}
|
|
.rank-num.top-three {
|
|
background: var(--primary-color);
|
|
color: #fff;
|
|
}
|
|
.rank-cover {
|
|
width: 40px;
|
|
height: 40px;
|
|
border-radius: 6px;
|
|
object-fit: cover;
|
|
flex-shrink: 0;
|
|
}
|
|
.rank-info {
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 4px;
|
|
min-width: 0;
|
|
}
|
|
.rank-title {
|
|
font-size: 14px;
|
|
font-weight: 500;
|
|
color: #303133;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
.rank-count {
|
|
font-size: 12px;
|
|
color: var(--text-secondary);
|
|
}
|
|
</style>
|