您的位置:首页 > Web前端 > Vue.js

antDesignVue 表格默认禁止选中

2020-06-06 07:33 113 查看
<template>
<a-table
:columns="columns"
:dataSource="data"
rowKey="id"
:loading="loading"
:pagination="pagination"
:rowSelection="rowSelection"
>
</a-table>
</template>
<script>
export default {
computed: {
rowSelection() {
const _this = this
const { selectedRowKeys } = this;
return {
selectedRowKeys,
onChange: (selectedRowKeys) => {
this.selectedRowKeys = selectedRowKeys;
if (this.selectedRowKeys.length) {
this.disabled = false;
} else {
this.disabled = true;
}
},
getCheckboxProps: record => ({
props: {
// 全部默认禁止选中
disabled: true,
// 某几项默认禁止选中(R: 当state等于1时)
// disabled: record.state == 1,
},
}),
};
},
}
}
</script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: