使用vue-print-nb打印el-table问题总结

css样式添加媒体查询 @media print {} 样式只有在打印的时候才会生效

1、解决单选框复选框打印时选中消失的问题

@media print {
  // 解决单选框复选框打印时选中消失的问题
  ::v-deep .el-radio__input,
  ::v-deep .el-checkbox__input {
    -webkit-print-color-adjust: exact;
    -moz-print-color-adjust: exact;
    color-adjust: exact;
  }
}

2、解决表格打印时表格显示不全的问题

 // 解决表格打印时表格显示不全的问题
  ::v-deep table {
    table-layout: auto !important;
  }
  ::v-deep .el-table__header-wrapper .el-table__header {
    width: 99% !important;
  }
  ::v-deep .el-table__body-wrapper .el-table__body {
    width: 98% !important;
  }
  ::v-deep #print table {
    table-layout: fixed !important;
  }

  ::v-deep .el-table__fixed {
    display: none;
  }

3、解决table 序号打印错乱问题

 ::v-deep .el-table .el-table__cell.is-hidden > * {
    visibility: visible;
    font-size: 12px;
  }

4、不需要打印的内容 在标签上添加class名 noPrint 即可

  .noPrint {
    display: none;
  }
  @page {
    size: auto;
    // margin: 3mm; // 页边距
  }

其他打印样式

  // form 表单打印样式调整
  ::v-deep .el-form-item__label {
    padding: 0;
    width: 90px !important;
  }
  ::v-deep .el-form-item__content {
    margin-left: 90px !important;
  }
  ::v-deep .el-select__caret {
    opacity: 0;
  }
  ::v-deep .el-form-item__label {
    padding: 0;
    width: 90px !important;
  }
  // 清除input边框
  ::v-deep .el-input__inner {
    max-width: 180px;
    padding: 0px;
    border: 0;
  }
  ::v-deep .el-table {
    .el-input__inner {
      display: none;
    }
  }
  // el-select 多选清除边距,icon和背景
  ::v-deep .el-input__icon {
    display: none;
  }
  ::v-deep .el-tag {
    padding: 0;
    border-width: 0;
  }
  ::v-deep .el-tag__close {
    display: none;
  }

相关推荐

  1. 使用vue-print-nb打印el-table问题总结

    2024-01-25 07:14:03       61 阅读
  2. vue-print-nb 前端打印的一个实现方案

    2024-01-25 07:14:03       27 阅读
  3. elmentUI el-table 总结

    2024-01-25 07:14:03       33 阅读
  4. vue 导出el-table选择的数据使用笔记

    2024-01-25 07:14:03       52 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-01-25 07:14:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-01-25 07:14:03       106 阅读
  3. 在Django里面运行非项目文件

    2024-01-25 07:14:03       87 阅读
  4. Python语言-面向对象

    2024-01-25 07:14:03       96 阅读

热门阅读

  1. go使用docker sdk停止和删除docker

    2024-01-25 07:14:03       63 阅读
  2. “大数据”能够对人力资源企业提供什么帮助?

    2024-01-25 07:14:03       60 阅读
  3. HBase学习五:运维排障之备份与恢复

    2024-01-25 07:14:03       53 阅读
  4. 012vuerouter

    2024-01-25 07:14:03       55 阅读
  5. spring boot+mybatis-plus配置读写分离

    2024-01-25 07:14:03       51 阅读