From bc4df96c517cb7b9157e6c79e34d7f47fadcb6f6 Mon Sep 17 00:00:00 2001 From: LiuJiaNan <15703339975@163.com> Date: Thu, 27 Aug 2026 08:59:20 +0800 Subject: [PATCH] =?UTF-8?q?feat(pdf):=20=E6=94=AF=E6=8C=81=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E5=BA=95=E9=83=A8=E8=87=AA=E5=AE=9A=E4=B9=89=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 PdfProps 中添加 extraButtons 属性,用于传入自定义按钮内容 - 组件内新增对 extraButtons 的接收和渲染支持 - 弹窗底部按钮列表中合并渲染 extraButtons 内容实现扩展功能 --- src/components/Pdf/index.d.ts | 4 +++- src/components/Pdf/index.js | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/Pdf/index.d.ts b/src/components/Pdf/index.d.ts index ac549ac..cb8cc2c 100644 --- a/src/components/Pdf/index.d.ts +++ b/src/components/Pdf/index.d.ts @@ -1,4 +1,4 @@ -import type { CSSProperties, FC } from "react"; +import type { CSSProperties, FC, ReactNode } from "react"; export interface PdfProps { /** pdf 文件地址 */ @@ -15,6 +15,8 @@ export interface PdfProps { inline?: boolean; /** 内联模式下的样式 */ style?: CSSProperties; + /** 弹窗底部额外的按钮 */ + extraButtons?: ReactNode; } declare const Pdf: FC; diff --git a/src/components/Pdf/index.js b/src/components/Pdf/index.js index 1922600..6650654 100644 --- a/src/components/Pdf/index.js +++ b/src/components/Pdf/index.js @@ -20,6 +20,7 @@ function Pdf(props) { inline = false, title = "PDF预览", style = {}, + extraButtons, } = props; const fileUrl = getFileUrl(); @@ -117,6 +118,7 @@ function Pdf(props) { {isFullscreen ? "退出全屏" : "全屏"} , , + ...(extraButtons || []), ]} > {renderPdfContent()}