This commit is contained in:
就眠儀式 2022-08-14 12:05:34 +08:00
parent ee3eb47b3f
commit c2a24dc9ed
2 changed files with 2 additions and 4 deletions

View File

@ -265,17 +265,15 @@ watch(
); );
const changeAll = (isChecked: boolean) => { const changeAll = (isChecked: boolean) => {
// Selected
if (isChecked) { if (isChecked) {
const datasources = props.dataSource.filter((item: any, index: number) => { const datasources = props.dataSource.filter((item: any, index: number) => {
return !props.getCheckboxProps(item, index).disabled; return !props.getCheckboxProps(item, index)?.disabled;
}); });
const ids = datasources.map((item) => { const ids = datasources.map((item) => {
return item[props.id]; return item[props.id];
}); });
tableSelectedKeys.value = [...ids]; tableSelectedKeys.value = [...ids];
} else { } else {
// unSelected
tableSelectedKeys.value = []; tableSelectedKeys.value = [];
} }
}; };

View File

@ -698,7 +698,7 @@ export default {
<template> <template>
<lay-button @click="changeSelectedKeys">修改选中值 {{ selectedKeys5 }}</lay-button> <lay-button @click="changeSelectedKeys">修改选中值 {{ selectedKeys5 }}</lay-button>
<lay-table :columns="columns23" :data-source="dataSource23" v-model:selectedKeys="selectedKeys5" :getCheckboxProps="getCheckboxProps"></lay-table> <lay-table :columns="columns23" :data-source="dataSource23" v-model:selectedKeys="selectedKeys5"></lay-table>
</template> </template>
<script> <script>