feat: 首页全部工具默认折叠+数量徽章
- 全部工具默认折叠(只显标题行), 点标题展开/收起带动画 - 标题左侧箭头(展开旋转90°), 右侧绿色徽章显示功能总数(108) - hover高亮, aria-expanded 验证: 默认折叠/徽章108/点击展开108卡/再点收起 ✓ CHANGELOG记录
This commit is contained in:
1 parent
e9a7dcac15
commit
59eaf2d7a7
2 files changed
+74
-5
No files matched your search
+67
-5
@@ -79,6 +79,9 @@ const { t } = useI18n();
|
||||
|
||||
const favoriteTools = computed(() => toolStore.favoriteTools);
|
||||
|
||||
// 全部工具默认折叠,点击标题展开,右侧显示数量
|
||||
const showAllTools = ref(false);
|
||||
|
||||
// Update favorite tools order when drag is finished
|
||||
function onUpdateFavoriteTools() {
|
||||
toolStore.updateFavoriteTools(favoriteTools.value); // Update the store with the new order
|
||||
@@ -214,17 +217,76 @@ function onUpdateFavoriteTools() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h3 class="mb-5px mt-25px text-neutral-400 font-500">
|
||||
{{ $t('home.categories.allTools') }}
|
||||
</h3>
|
||||
<div class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<ToolCard v-for="tool in toolStore.tools" :key="tool.name" :tool="tool" />
|
||||
<div class="all-tools">
|
||||
<div class="all-tools-head" role="button" :aria-expanded="showAllTools" @click="showAllTools = !showAllTools">
|
||||
<span class="all-tools-l">
|
||||
<span class="all-tools-arrow" :class="{ open: showAllTools }">▶</span>
|
||||
{{ $t('home.categories.allTools') }}
|
||||
</span>
|
||||
<span class="all-tools-count">{{ toolStore.tools.length }}</span>
|
||||
</div>
|
||||
<transition name="height">
|
||||
<div v-if="showAllTools" class="grid grid-cols-1 gap-12px lg:grid-cols-3 md:grid-cols-3 sm:grid-cols-2 xl:grid-cols-4">
|
||||
<ToolCard v-for="tool in toolStore.tools" :key="tool.name" :tool="tool" />
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped lang="less">
|
||||
// 全部工具:默认折叠,标题左侧箭头 + 右侧数量徽章
|
||||
.all-tools {
|
||||
margin-top: 25px;
|
||||
|
||||
.all-tools-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
padding: 7px 8px;
|
||||
border-radius: 9px;
|
||||
margin-bottom: 5px;
|
||||
transition: background 0.15s;
|
||||
|
||||
&:hover {
|
||||
background: rgba(128, 128, 128, 0.07);
|
||||
}
|
||||
|
||||
.all-tools-l {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 7px;
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.all-tools-arrow {
|
||||
font-size: 11px;
|
||||
opacity: 0.6;
|
||||
transition: transform 0.18s;
|
||||
|
||||
&.open {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
|
||||
.all-tools-count {
|
||||
min-width: 30px;
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
background: rgba(24, 160, 88, 0.15);
|
||||
color: #18a058;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 精选推荐区块:琥珀色调,与绿色「近期新功能」视觉区分(提高优先级覆盖 .nf-card)
|
||||
.nf-block.reco-block {
|
||||
.nf-title {
|
||||
|
||||
Reference in new issue
Block a user