fix: adjust print content (#4746)

* fix: adjust print content

* fix: bug
This commit is contained in:
jack zhang 2024-06-25 11:42:51 +08:00 committed by GitHub
parent 935f9892fc
commit 9daf893704
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,10 +14,19 @@ export const useDetailPrintActionProps = () => {
const context = useFormBlockContext();
const { formBlockRef } = useDetailsBlockContext();
const printHandler = useReactToPrint({
content: () => context?.formBlockRef?.current || formBlockRef?.current,
content: () => {
const content = context?.formBlockRef?.current || formBlockRef?.current;
if (!content || !content.querySelector('.nb-grid')) {
return null;
}
return content.querySelector('.nb-grid');
},
pageStyle: `@media print {
* {
margin: 0;
}
.nb-grid {
padding-top: 20px !important;
}
:not(.ant-formily-item-control-content-component) > div.ant-formily-layout div.nb-action-bar { {
overflow: hidden; height: 0;