a-table 鼠标滑过显示小手,当前行可点击(转载)

需求:鼠标滑过表单行时,出现小手,点击时,可以跳转至编辑页
文档地址:https://antdv.com/components/table-cn/
实践操作:

<template>
<a-table
:loading="loading"
:columns="columns"
:data-source="dataSource.list"
rowKey="Id"
:pagination="paginationSet"
:locale="locale"
v-if="!cardloading"
:customRow="click" // 关键点
>
<!-- 业务内容 -->
</a-table>
</template>
<script>
export default {
methods: {
toEdit (Id) {
this.$router.push({ path: '/route/EditRoute', query: { pId: Id } })
},
click (record, index) {
return {
style: {
'cursor': 'pointer'
},
on: {
click: () => {
console.log(record, index)
this.toEdit(record.Id)
}
}
}
}
}
}
</script>

posted @ 2024-04-30 15:50  雪莉06  阅读(95)  评论(0编辑  收藏  举报