Skip to content

Commit

Permalink
fix: 全选套餐中的所有配置文件反应时间慢 (#3491)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuikill committed Sep 4, 2024
1 parent 27f141a commit 29fc165
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,19 @@
const emits = defineEmits(['toggleOpen', 'update:selectedConfigs', 'change']);
const selectedConfigIds = computed(() => new Set(props.selectedConfigs.map((item) => item.id)));
const isAllSelected = computed(() => {
const res = props.configList.length > 0 && props.configList.every((item) => isConfigSelected(item.id));
return res;
return props.configList.every((item) => selectedConfigIds.value.has(item.id));
});
const isIndeterminate = computed(() => {
const res = props.configList.length > 0 && props.selectedConfigs.length > 0 && !isAllSelected.value;
return res;
const selectedCount = props.selectedConfigs.length;
const totalCount = props.configList.length;
return selectedCount > 0 && selectedCount < totalCount && !isAllSelected.value;
});
const isConfigSelected = (id: number) => props.selectedConfigs.findIndex((item) => item.id === id) > -1;
const isConfigSelected = (id: number) => selectedConfigIds.value.has(id);
const handleAllSelectionChange = (checked: boolean) => {
const configs = props.selectedConfigs.slice();
Expand Down

0 comments on commit 29fc165

Please sign in to comment.