添加 Info 非空判断
This commit is contained in:
@@ -2,7 +2,7 @@ import { memo } from "preact/compat";
|
||||
|
||||
/** 从原 info panel 抄一点精简的信息 */
|
||||
export type Infos = {
|
||||
codeText: string;
|
||||
codeText?: string;
|
||||
actorList: {
|
||||
text: string;
|
||||
link: string;
|
||||
@@ -16,20 +16,26 @@ const Info = memo(({ infos }: { infos: Infos }) => {
|
||||
<span
|
||||
className="jop-info-code"
|
||||
title="点击复制"
|
||||
onClick={() => navigator.clipboard.writeText(infos.codeText)}
|
||||
onClick={() => infos.codeText && navigator.clipboard.writeText(infos.codeText)}
|
||||
>
|
||||
{infos.codeText}
|
||||
{infos.codeText ? infos.codeText : "暂无"}
|
||||
</span>
|
||||
|
||||
<div class="jop-info-actor">
|
||||
<a
|
||||
class="jop-info-actor-item"
|
||||
target="_blank"
|
||||
href={infos.actorList[0].link}
|
||||
>
|
||||
{infos.actorList[0].text}
|
||||
</a>
|
||||
<span> 等</span>
|
||||
{infos.actorList.length !== 0 ? (
|
||||
<>
|
||||
<a
|
||||
class="jop-info-actor-item"
|
||||
target="_blank"
|
||||
href={infos.actorList[0].link}
|
||||
>
|
||||
{infos.actorList[0].text}
|
||||
</a>
|
||||
<span> 等</span>
|
||||
</>
|
||||
) : (
|
||||
<div>无演员信息</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* {info.actorList.map((item, index) => { const length = info.actorList.length; return ( <a href={item.link} style={{ paddingRight: length !== 1 && index !== length - 1 ? 16 : 0 }} > {item.text} </a> ); })} */}
|
||||
|
||||
Reference in New Issue
Block a user