在vue2中 vue ant design a-table每一行添加点击事件 在a-table中添加 :customRow="rowClick"

<!-- 在 a-table 中添加 :customRow="rowClick"-->
  <a-table
    bordered
    ref="table"
    size="middle"
    :columns="columns"
    :dataSource="dataSource"
    :loading="loading"
    @change="handleTableChange"
    :customRow="rowClick"
    :scroll="{ x: 'calc(700px + 50%)', y: 500 }"
  >
// 在methods中添加对应方法
rowClick(item, index) {
  return {
    on: {
      click: () => {
        this.edit(null, item, null)
      },
      mouseenter: () => {
        // cursor: pointer;
        // item.style.cursor = 'hand'
      }
    },
  }
},
posted @ 2023-02-07 17:00  你笑的好瓜  阅读(317)  评论(0)    收藏  举报