diff --git a/src/components/Excel/index.d.ts b/src/components/Excel/index.d.ts index cbf0ba7..d571263 100644 --- a/src/components/Excel/index.d.ts +++ b/src/components/Excel/index.d.ts @@ -1,4 +1,4 @@ -import type { FC } from "react"; +import type { CSSProperties, FC, ReactNode } from "react"; export interface ExcelProps { /** 是否显示弹窗 */ @@ -13,8 +13,10 @@ export interface ExcelProps { inline?: boolean; /** 弹窗标题 */ title?: string; - /** 内容样式 */ - style?: Record; + /** 内联模式下的样式 */ + style?: CSSProperties; + /** 弹窗底部额外的按钮 */ + extraButtons?: ReactNode; } declare const Excel: FC; diff --git a/src/components/Excel/index.js b/src/components/Excel/index.js index 8a76d52..9efaf80 100644 --- a/src/components/Excel/index.js +++ b/src/components/Excel/index.js @@ -19,6 +19,7 @@ function Excel(props) { inline = false, title = "Excel预览", style = {}, + extraButtons, } = props; const containerRef = useRef(null); @@ -121,6 +122,7 @@ function Excel(props) { 关闭 , , + ...(extraButtons || []), ]} > {renderExcelContent()} 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 c6defba..8d987f4 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()} diff --git a/src/components/Word/index.d.ts b/src/components/Word/index.d.ts index 008ed4e..4612518 100644 --- a/src/components/Word/index.d.ts +++ b/src/components/Word/index.d.ts @@ -1,4 +1,4 @@ -import type { FC } from "react"; +import type { CSSProperties, FC, ReactNode } from "react"; export interface WordProps { /** 是否显示弹窗 */ @@ -13,8 +13,10 @@ export interface WordProps { inline?: boolean; /** 弹窗标题 */ title?: string; - /** 内容样式 */ - style?: Record; + /** 内联模式下的样式 */ + style?: CSSProperties; + /** 弹窗底部额外的按钮 */ + extraButtons?: ReactNode; } declare const Word: FC; diff --git a/src/components/Word/index.js b/src/components/Word/index.js index ef85414..033b52c 100644 --- a/src/components/Word/index.js +++ b/src/components/Word/index.js @@ -16,6 +16,7 @@ function Word(props) { inline = false, title = "Word预览", style = {}, + extraButtons, } = props; const contentRef = useRef(null); @@ -114,6 +115,7 @@ function Word(props) { 关闭 , , + ...(extraButtons || []), ]} > {renderWordContent()}