antd vue 树形表格操作按钮怎么拿到当前行的record
我这样子拿不到它的record,也无法操作,请问该如何去修改
<template>
<page-header-wrapper>
<a-card :loading="loading" :style="{ marginBottom: '24px' }">
<div class="table">
<a-table :columns="columns" bordered :data-source="data">
<a slot="action" @click="addPermission(record)">Delete</a>
</a-table>
</div>
</a-card>
</page-header-wrapper>
</template>
<script>
const columns = [{
title: '标题',
dataIndex: 'name',
key: 'name'
},
{
title: '名称',
dataIndex: 'name',
key: 'name',
width: '12%'
},
{
title: '操作',
dataIndex: '',
key: 'x',
scopedSlots: {
customRender: 'action'
}
}
]
const data = [{
key: 1,
name: 'John Brown sr.',
age: 60,
address: 'New York No. 1 Lake Park',
children: [{
key: 11,
name: 'John Brown',
age: 42,
address: 'New York No. 2 Lake Park'
},
{
key: 12,
name: 'John Brown jr.',
age: 30,
address: 'New York No. 3 Lake Park',
children: [{
key: 121,
name: 'Jimmy Brown',
age: 16,
address: 'New York No. 3 Lake Park'
}]
},
{
key: 13,
name: 'Jim Green sr.',
age: 72,
address: 'London No. 1 Lake Park',
children: [{
key: 131,
name: 'Jim Green',
age: 42,
address: 'London No. 2 Lake Park',
children: [{
key: 1311,
name: 'Jim Green jr.',
age: 25,
address: 'London No. 3 Lake Park'
},
{
key: 1312,
name: 'Jimmy Green sr.',
age: 18,
address: 'London No. 4 Lake Park'
}
]
}]
}
]
},
{
key: 2,
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park'
}
]
const rowSelection = {
onChange: (selectedRowKeys, selectedRows) => {
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows)
},
onSelect: (record, selected, selectedRows) => {
console.log(record, selected, selectedRows)
},
onSelectAll: (selected, selectedRows, changeRows) => {
console.log(selected, selectedRows, changeRows)
}
}
export default {
data() {
return {
data,
columns,
rowSelection,
expandedRowKeys: []
}
},
methods: {
addPermission(row) {
console.log(row)
}
}
}
</script>
<style>
</style>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
少了个slot-scope哦