Skip to content

[Ques]: 不同浏览器兼容相关的边框和标题问题 #20

@stupidZhu

Description

@stupidZhu

Describe the Question / 问题描述

在 firefox 中都正常, 但是在 chrome/edge 中会出现 popTitle 不生效, 右侧边框消失的情况
下面是在 chrome/edge 中的表现

  • 设置 popTitle 后, 打印窗口页眉正常改变, 但导出的 pdf 命名仍然是主窗口的 title
  • 右侧边框消失(可以设置容器padding-right:1px; 解决), 如下图
Image Image

测试代码如下

<script setup lang="ts">
import { VuePrintNext } from 'vue-print-next';
import PrintPageLayout from '../components/PrintPageLayout.vue';

function handleBasicPrint() {
  new VuePrintNext({ el: '#print-el', popTitle: 'hello world' });
}
</script>
<template>
  <PrintPageLayout
    title="基础打印示例"
    description="边框内容"
  >
    <template #buttons>
      <button class="print-btn secondary" @click="handleBasicPrint">
        <span class="btn-icon">⚙️</span> 方法打印
      </button>
    </template>
    <div id="print-el">
      <div class="print-box"></div>
      <table class="print-table">
        <tbody>
          <tr>
            <td>1</td>
            <td>2</td>
          </tr>
        </tbody>
      </table>
    </div>
  </PrintPageLayout>
</template>

<style scoped>
.print-box{
  border: 1px solid #000;
  height: 100px;
}

.print-table {
  width: 100%;
  border-radius: 0;
  border-collapse: collapse;
  th,
  td {
    border: 1px solid #000;
    padding: 8px;
  }
}
</style>

因为在 firefox 中一切正常, 可能和不同浏览器的实现有关, 不知道是否可以解决

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions