diff --git a/package.json b/package.json index 4794be8..f461610 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kne/react-file", - "version": "0.1.26", + "version": "0.1.27", "description": "提供了文件上传,文件预览,文件批量管理等功能", "syntax": { "esmodules": true diff --git a/src/components/PrintButton/index.js b/src/components/PrintButton/index.js index d8917be..e5042a8 100644 --- a/src/components/PrintButton/index.js +++ b/src/components/PrintButton/index.js @@ -2,13 +2,14 @@ import React, { useState } from 'react'; import { Button } from 'antd'; import { useReactToPrint } from 'react-to-print'; -const PrintButton = ({ content, onSuccess, onError, printProps, contentRef, ...props }) => { +const PrintButton = ({ content, onSuccess, onError, onBeforePrint, printProps, contentRef, ...props }) => { const [isLoading, setIsLoading] = useState(false); const handler = useReactToPrint({ contentRef, bodyClass: document.body.getAttribute('class'), - onBeforePrint: async () => { + onBeforePrint: async (...args) => { setIsLoading(true); + onBeforePrint && (await onBeforePrint(...args)); }, onPrintError: (...args) => { setIsLoading(false);