fix: 文章页title、标题

main
fadeaway 6 months ago
parent 093587650e
commit d94c94ef80

@ -20,7 +20,11 @@ export default function Article() {
useEffect(() => {
const { searchParams } = new URL(window.location.href);
getArticleInfo((searchParams as any)?.get('id')).then((res) => {
setArticleInfo(res?.data || {});
const aInfo = res?.data || {};
setArticleInfo(aInfo);
if (aInfo?.title) {
document.title = aInfo?.title;
}
});
}, []);
@ -35,7 +39,7 @@ export default function Article() {
return (
<main className="max-w-screen-sm min-h-screen mx-auto flex flex-col items-center text-[#000000f2] font-normal bg-white px-[18px] pt-[14px] pb-[36px]">
<h1 className="font-600 text-[22px] leading-[30.8px]">{articleInfo?.title}</h1>
<h1 className="font-600 text-[22px] leading-[30.8px] text-left w-full">{articleInfo?.title}</h1>
{(articleInfo?.userName || displayDate) && (
<p className="w-full flex items-center text-[12px] text-[#000000b2] leading-[16.8px] mt-[9px]">
<span>{articleInfo?.userName}</span>

Loading…
Cancel
Save