import { articleDetail, listArticles } from "@/app/api/articles"; import Link from "next/link"; import Image from "next/image"; import { htmlToText } from "html-to-text"; const LatestNews = async () => { const { lists } = await listArticles({ pageNo: 1, cid: "4", pageSize: 1, sort: "new", }); if (!lists?.length) { return <>; } const { id } = lists[0]; const article = await articleDetail({ id: `${id}`, }); const content = htmlToText(article.content, { selectors: [{ selector: "img", format: "skip" }], }); return (
{""}
{article.title} {content} 更多新闻内容>>
); }; export default LatestNews;