vue-plugin-hiprint icon indicating copy to clipboard operation
vue-plugin-hiprint copied to clipboard

[Bug]: 预览自动生成的页码和调用打印api展示的不一样(打印中一页的最后几条数据被截掉了缺省了几条数据)

Open abc821178885 opened this issue 1 year ago • 2 comments

使用的版本

latest

版本号

0.0.57-beta20

你的安装方式

NPM 依赖

你的操作系统

Windows

你的浏览器

Chrome

你的项目编程语言

Vue 2

问题描述

在预览的时候,调用getHtml() 浏览的都是正常的,但是通过调用print()的时候打印浏览页面存在表格内数据(表头内的数据大概有20个) 例如 1-- 20 21--40 41--60 的时候 页面在15条左右就被截掉了, 变成1--15 21--35 41--55,但是当我删掉几个表头之后,不管是打印还是预览页又正常了

如何复现

/** 传入数据进行预览 */ async preview(_data?: Arrayable<Record<string, any>>) { await until(() => !!hiprintTemplate.value).toBeTruthy();

  const data = formatterData(_data);
  const templates = [{
    template: hiprintTemplate.value,
    data,
  }];

  showPreivew.value = true;
  nextTick(() => {
    // 预览窗口宽度
    (unrefElement(previewDialogRef.value)!.querySelector('.el-dialog')! as HTMLDivElement).style.width = `${panelConfig.value.width}mm`;

    // 预览数据
    $(previewRef.value).html(hiprint.getHtml({ templates }));
  });
},
/** 传入数据打印模板 */
async print(_data?: Arrayable<Record<string, any>>) {
  await until(() => !!hiprintTemplate.value).toBeTruthy();

  const data = formatterData(_data);
  const templates = [{
    template: hiprintTemplate.value,
    data,
  }];

  // 打印数据
  hiprint.print({ templates });
},

预期结果

预览打印的时候正常

实际结果

打印浏览页数据发生了缺失

截图或视频

1713948979936 1713948979945

这个问题是否已经存在?

  • [X] 我已经搜索过现有的问题 (https://github.com/CcSimple/vue-plugin-hiprint/issues)

abc821178885 avatar Apr 24 '24 08:04 abc821178885

表格内容 如果存在换行。就有这个BUG。

可以尝试固定 表体行高。

CcSimple avatar Apr 24 '24 11:04 CcSimple

如果是表体行高有时候没办法确定,有什么方式可以修复这个问题吗

abc821178885 avatar Apr 25 '24 00:04 abc821178885