【issues/5595】BasicTable组件hideSelectAll: true无法隐藏全选框
parent
75bf9784e4
commit
a67f074690
|
@ -1,10 +1,17 @@
|
|||
<!-- 自定义选择列,表头实现部分 -->
|
||||
<template>
|
||||
<!-- update-begin--author:liaozhiyang---date:20231130---for:【issues/5595】BasicTable组件hideSelectAll: true无法隐藏全选框 -->
|
||||
<template v-if="isRadio">
|
||||
<!-- radio不存在全选,所以放个空标签 -->
|
||||
<span></span>
|
||||
</template>
|
||||
<a-checkbox :disabled="disabled" v-else :checked="checked" :indeterminate="isHalf" @update:checked="onChange" />
|
||||
<template v-else>
|
||||
<template v-if="hideSelectAll">
|
||||
<span></span>
|
||||
</template>
|
||||
<a-checkbox :disabled="disabled" v-else :checked="checked" :indeterminate="isHalf" @update:checked="onChange" />
|
||||
</template>
|
||||
<!-- update-end--author:liaozhiyang---date:20231130---for:【issues/5595】BasicTable组件hideSelectAll: true无法隐藏全选框 -->
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue';
|
||||
|
@ -23,6 +30,10 @@
|
|||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
hideSelectAll: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
// update-begin--author:liaozhiyang---date:20231016---for:【QQYUN-6774】解决checkbox禁用后全选仍能勾选问题
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
|
|
|
@ -123,6 +123,7 @@ export function useCustomSelection(
|
|||
pageSize: currentPageSize.value,
|
||||
// 【QQYUN-6774】解决checkbox禁用后全选仍能勾选问题
|
||||
disabled: flattedData.value.length == 0,
|
||||
hideSelectAll: unref(propsRef)?.rowSelection?.hideSelectAll,
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -130,8 +131,10 @@ export function useCustomSelection(
|
|||
watch(
|
||||
() => unref(propsRef)?.rowSelection?.selectedRowKeys,
|
||||
(val: string[]) => {
|
||||
if (Array.isArray(val)) {
|
||||
setSelectedRowKeys(val);
|
||||
// 解决selectedRowKeys在页面调用处使用ref失效
|
||||
const value = unref(val);
|
||||
if (Array.isArray(value)) {
|
||||
setSelectedRowKeys(value);
|
||||
}
|
||||
},
|
||||
{ immediate: true }
|
||||
|
|
Loading…
Reference in New Issue