Ant Design of Vue 的表格使用,根据当前代码,实现以下功能
<template>
<a-table :columns="columns" :data-source="data" @change="onChange">
<!-- 任务名称 -->
<div slot="filterDropdown_name" style="padding: 0; width: 200px">
<a-checkbox-group style="padding: 3px 8px" :value="checkTypeone" @change="handleTypeChangeone">
<a-checkbox
v-for="(v, i) in optionoperator"
:value="v.label"
:key="i"
style="width: 100%; margin-left: 0"
>
{{ v.value }}
</a-checkbox>
</a-checkbox-group>
<div style="display: flex; justify-content: space-between; border-top: 1px #eee solid; padding: 5px 8px">
<a-button @click="handleSelectone" type="primary" size="small" style="width: 56px; font-size: 12px">
确定
</a-button>
</div>
</div>
</a-table>
</template>
<script>
const columns = [
{
title: 'Name',
dataIndex: 'name',
scopedSlots: {
customRender: 'name',
filterDropdown: 'filterDropdown_name',
filterIcon: 'filterIcon_name',
},
},
{
title: 'Age',
dataIndex: 'age',
defaultSortOrder: 'descend',
sorter: (a, b) => a.age - b.age,
},
{
title: 'Address',
dataIndex: 'address',
filters: [
{
text: 'London',
value: 'London',
},
{
text: 'New York',
value: 'New York',
},
],
filterMultiple: false,
onFilter: (value, record) => record.address.indexOf(value) === 0,
sorter: (a, b) => a.address.length - b.address.length,
sortDirections: ['descend', 'ascend'],
},
]
const data = [
{
key: '1',
name: 'John Brown',
age: 32,
address: 'New York No. 1 Lake Park',
},
{
key: '2',
name: 'Jim Green',
age: 42,
address: 'London No. 1 Lake Park',
},
{
key: '3',
name: 'Joe Black',
age: 32,
address: 'Sidney No. 1 Lake Park',
},
{
key: '4',
name: 'Jim Red',
age: 32,
address: 'London No. 2 Lake Park',
},
]
function onChange(pagination, filters, sorter) {
console.log('params', pagination, filters, sorter)
}
export default {
data() {
return {
data,
columns,
checkTypeone:'',
optionoperator:[
{value:"wode",lable:1},
{value:"nide",lable:2},
]
}
},
methods: {
onChange,
handleSelectone() {
console.log(1)
},
handleTypeChangeone(){
console.log(3);
}
},
}
</script>