From 08b04b418b3c1cfc5d94ee0277a72a53efb30e8f Mon Sep 17 00:00:00 2001 From: wuduoyi Date: Fri, 10 May 2024 11:40:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20word=20=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E5=A4=B1=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/amis-core/src/actions/PrintAction.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/amis-core/src/actions/PrintAction.ts b/packages/amis-core/src/actions/PrintAction.ts index 19d920e6f..eb76da46c 100644 --- a/packages/amis-core/src/actions/PrintAction.ts +++ b/packages/amis-core/src/actions/PrintAction.ts @@ -8,7 +8,7 @@ import { } from './Action'; export interface IPrintAction extends ListenerAction { - actionType: 'copy'; + actionType: 'print'; args: { id?: string; ids?: string[]; @@ -28,6 +28,21 @@ export class PrintAction implements RendererAction { renderer: ListenerContext, event: RendererEvent ) { + // 兼容之前的 word 打印 + if (action.componentId) { + const targetComponent = event.context.scoped?.getComponentById( + action.componentId + ); + targetComponent?.doAction( + { + ...action, + target: undefined + }, + renderer + ); + return; + } + if (action.args?.id) { const element = document.querySelector(`[data-id='${action.args.id}']`); if (element) {