22import { type Ref } from " vue" ;
33import PageFooter from " ./PageFooter.vue" ;
44import { RouteLink , type SiteData , useSiteData } from " vuepress/client" ;
5+ import { getTagPathByTag } from " ../composables/useComponentUtils" ;
56import { type PagesMap , defaultConstants } from " ../../shared" ;
67
78const siteData: Ref <SiteData & { pagesMap: PagesMap }> = useSiteData () as any ;
@@ -11,16 +12,26 @@ const { exceptHomeListSlug } = defaultConstants;
1112const trimArticles = articles .filter ((article ) => {
1213 return ! exceptHomeListSlug .includes (article .slug );
1314});
15+
16+ console .log (trimArticles );
1417 </script >
1518
1619<template >
1720 <div class =" v-nc-theme-home" >
1821 <div class =" page-main" >
1922 <div class =" home-article-list" >
2023 <div class =" article" v-for =" article in trimArticles" >
21- <RouteLink class =" no-underline title" :to =" article.pathInferred!" >{{
22- article.data.title
23- }}</RouteLink >
24+ <RouteLink class =" home-link" :to =" article.pathInferred!" >
25+ <span class =" title" >{{ article.data.title }}</span >
26+ <span class =" tags" >
27+ <RouteLink
28+ class =" tag"
29+ v-for =" tag in article.routeMeta?._blog?.tags"
30+ :to =" getTagPathByTag(tag)"
31+ >{{ tag }}</RouteLink
32+ >
33+ </span >
34+ </RouteLink >
2435 </div >
2536 </div >
2637 <PageFooter />
@@ -33,15 +44,26 @@ const trimArticles = articles.filter((article) => {
3344 @apply flex flex-col justify-center items-center;
3445}
3546.home-article-list {
36- @apply w-1/ 2 h-fit flex flex-wrap justify-center items-center gap-x-2 gap-y-0 .5 my-24;
47+ @apply w-1/ 2 h-fit flex flex-wrap items-center gap-2 my-24;
3748}
49+
3850.article {
3951 @apply w-fit h-fit;
4052}
41- .article .title {
42- @apply inline-block max-w-60 h-full px-1
53+ .article .home-link {
54+ @apply inline-flex flex-col justify-center max-w-60 h-full px-1
4355 rounded border-2 border-transparent bg-zinc-100 dark :bg-zinc-600
44- hover :border-green-300
45- select-none truncate cursor-pointer transition-all ease-in-out duration-300;
56+ hover :bg-green-100 hover:border-green-300 dark:hover:bg-green-700 dark:hover:border-green-500
57+ select-none cursor-pointer transition-all ease-in-out duration-300;
58+ }
59+ .home-link .title {
60+ @apply inline-block max-w-60
61+ text-xl
62+ truncate;
63+ }
64+ .home-link .tags {
65+ @apply inline-flex max-w-60 gap-0.5
66+ flex-wrap
67+ text-sm;
4668}
4769 </style >
0 commit comments