fix: 修复 word 打印失效问题

This commit is contained in:
wuduoyi 2024-05-10 11:40:15 +08:00
parent 8800cf4c6b
commit 08b04b418b

View File

@ -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<any>
) {
// 兼容之前的 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) {