目前在学习使用antd中,需求双击表格行显示pdf,在table中给customRow设置行属性
在这里插入图片描述

    <a-table
      bordered
      :rowSelection="rowSelection"
      :columns="columns"
      :dataSource="data"
      rowKey="id"
      :customRow="Rowclick"
      :pagination="pagination"
      :scroll="{ y: 520 }"
      size="small"
    >
      <span slot="sex" slot-scope="sex">
        {{ sex == 1 ? "男" : sex == 0 ? "女" : "/" }}
      </span>
      <span slot="status" slot-scope="status">
        {{ status == 1 ? "已打印" : "未打印" }}
      </span>
    </a-table>

methods中

    Rowclick(record, index) {
      return {
        on: {
          click: () => {},
          dblclick: () => {
            console.log(record, index, 2222);
            this.showPdf = true;
            let url = "demo.pdf";
            this.pSrc = "/static/pdf/web/viewer.html?file=" + url;
            // window.open("/static/pdf/web/viewer.html?file=" + url);
          }
        }
      };
    },
Logo

前往低代码交流专区

更多推荐