Ant-design-vue: ATable component cannot set customRow to trigger row click

Created on 25 Sep 2020  ·  3Comments  ·  Source: vueComponent/ant-design-vue

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

2.0.0-beta.10

Environment

"ant-design-vue": "^2.0.0-beta.10","vue": "^3.0.0-rc.1",

Reproduction link

https://2x.antdv.com/components/table-cn/#Table-

Steps to reproduce

<template>
  <ATable :data-source="state.list" rowKey="id" :customRow="customRow">
  <ATableColumn key="date" title="date" data-index="date" />
</ATable>
</template>

<script>
import { reactive } from 'vue'
export default {
name: 'CustomExample',
setup() {
const state = reactive({
list: [
{
id: 1,
date: '第一天',
},
{
id: 2,
date: '第二天',
},
],
})

function customRow(record, index) {
return {
on: {
click: (e) => {
console.log(e, record, index)
},
},
}
}

return {
state,
customRow,
}
}
}
</script>

What is expected?

It can set customRow to trigger row click event

What is actually happening?

cannot trigger row click event

Most helpful comment

customRow: record => { return { click: event => { console.log(event, record); } }; }
看了源码,发现这样可行。

All 3 comments

发生同样的情况,求解

customRow: record => { return { click: event => { console.log(event, record); } }; }
看了源码,发现这样可行。

customRow: record => { return { click: event => { console.log(event, record); } }; }

原来是要去掉 on 呀,不了解 jsx 的 on,哈哈哈

Was this page helpful?
0 / 5 - 0 ratings