feat: 每日资讯置顶+每列10条+框内滚动

- 资讯移到首页最顶部(精选推荐之上)
- 每列抓取 5→10 条(github/news/ai/it/stock)
- 每列固定240px(恰好5条)超出框内滚动

验证: 顺序正确/10条/固定5条可见/框内滚动 ✓

CHANGELOG记录
This commit is contained in:
personal82555 committed 2026-10-13 16:03:40 +08:00
1 parent cd0264acc2
commit 4d7c398510
3 files changed
+57 -36

No files matched your search

+44 -30
View File
@@ -87,6 +87,36 @@ function onUpdateFavoriteTools() {
<template>
<div class="pt-50px">
<!-- 每日 5 列资讯 -->
<div v-if="newsCols.length" class="news-block">
<div class="nf-head">
<span class="nf-title">📰 每日资讯</span>
<span class="nf-sub">每天 08:00 自动更新{{ newsDate ? ' · ' + newsDate : '' }}</span>
</div>
<div class="news-grid">
<div v-for="col in newsCols" :key="col.key" class="news-col">
<div class="news-col-head">
<span class="news-col-icon">{{ col.icon }}</span>
<span class="news-col-title">{{ col.title }}</span>
</div>
<div class="news-list">
<a
v-for="(it, i) in col.items"
:key="i"
class="news-item"
:href="it.url"
target="_blank"
rel="noopener noreferrer"
>
<span class="news-title">{{ it.title }}</span>
<span class="news-time">{{ it.time }}</span>
</a>
<div v-if="!col.items.length" class="news-empty">暂无内容</div>
</div>
</div>
</div>
</div>
<!-- 精选推荐(管理后台配置,置顶独立列表) -->
<div v-if="recoList.length" class="nf-block reco-block">
<div class="nf-head">
@@ -121,36 +151,6 @@ function onUpdateFavoriteTools() {
</div>
</div>
<!-- 每日 5 列资讯 -->
<div v-if="newsCols.length" class="news-block">
<div class="nf-head">
<span class="nf-title">📰 每日资讯</span>
<span class="nf-sub">每天 08:00 自动更新{{ newsDate ? ' · ' + newsDate : '' }}</span>
</div>
<div class="news-grid">
<div v-for="col in newsCols" :key="col.key" class="news-col">
<div class="news-col-head">
<span class="news-col-icon">{{ col.icon }}</span>
<span class="news-col-title">{{ col.title }}</span>
</div>
<div class="news-list">
<a
v-for="(it, i) in col.items"
:key="i"
class="news-item"
:href="it.url"
target="_blank"
rel="noopener noreferrer"
>
<span class="news-title">{{ it.title }}</span>
<span class="news-time">{{ it.time }}</span>
</a>
<div v-if="!col.items.length" class="news-empty">暂无内容</div>
</div>
</div>
</div>
</div>
<div class="grid-wrapper">
<div class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">
<ColoredCard v-if="config.showBanner" :title="$t('home.follow.title')" :icon="IconHeart">
@@ -385,6 +385,20 @@ function onUpdateFavoriteTools() {
.news-list {
display: flex;
flex-direction: column;
// 固定显示约 5 条的高度(每条约 48px),超出在框内滚动
height: 240px;
overflow-y: auto;
overscroll-behavior: contain;
scrollbar-width: thin;
&::-webkit-scrollbar {
width: 6px;
}
&::-webkit-scrollbar-thumb {
background: rgba(24, 160, 88, 0.35);
border-radius: 3px;
}
}
.news-item {