refactor: filter页面使用图片懒加载组件
This commit is contained in:
@@ -6,6 +6,7 @@ import Folder from "@/assets/icon/folder.png?url";
|
|||||||
import { formatDatetime } from "@/lib/format.ts";
|
import { formatDatetime } from "@/lib/format.ts";
|
||||||
import { createHttp } from "@/lib/request";
|
import { createHttp } from "@/lib/request";
|
||||||
import type { CategoriesStats, Post, Tag } from "@/types";
|
import type { CategoriesStats, Post, Tag } from "@/types";
|
||||||
|
import LazyImage from "@/components/LazyImage.astro";
|
||||||
|
|
||||||
const http = createHttp(Astro.request.headers);
|
const http = createHttp(Astro.request.headers);
|
||||||
|
|
||||||
@@ -144,7 +145,7 @@ const isActive = (targetType: string, targetCode: string) =>
|
|||||||
<li class="post-card">
|
<li class="post-card">
|
||||||
<a class="post-cover" href={`/post/${post.slug}`} aria-label={post.title}>
|
<a class="post-cover" href={`/post/${post.slug}`} aria-label={post.title}>
|
||||||
{post.cover ? (
|
{post.cover ? (
|
||||||
<img src={post.cover} alt={post.title} loading="lazy" />
|
<LazyImage src={post.cover} alt={post.title} />
|
||||||
) : (
|
) : (
|
||||||
<span class="cover-placeholder">{post.title[0]}</span>
|
<span class="cover-placeholder">{post.title[0]}</span>
|
||||||
)}
|
)}
|
||||||
@@ -343,7 +344,6 @@ const isActive = (targetType: string, targetCode: string) =>
|
|||||||
font-size: 40px;
|
font-size: 40px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
background: linear-gradient(135deg, #4f6df5, #7b5cf0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-cover img {
|
.post-cover img {
|
||||||
|
|||||||
Reference in New Issue
Block a user