File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change 66 />
77
88 <v-col
9- v-else-if =" showSearch || slots[`top.left`] || slots[`top.right`]"
9+ v-else-if =" ( showSearch || slots[`top.left`] || slots[`top.right`]) && showTopContent "
1010 lg =" 12"
1111 >
12- <v-row >
12+ <v-row :data-id = " `vdt-top-id-${props.level}` " >
1313 <slot
1414 v-if =" slots[`top.left`]"
1515 name =" top.left"
@@ -59,7 +59,6 @@ const emit = defineEmits([
5959 ' update:search' ,
6060]);
6161
62-
6362const props = withDefaults (defineProps <TopSlotProps >(), {
6463 searchProps : () => ({
6564 cols: {
@@ -76,6 +75,7 @@ const props = withDefaults(defineProps<TopSlotProps>(), {
7675});
7776
7877const levelSearch = ref <string >(' ' );
78+ const showTopContent = ref <boolean >(true );
7979
8080const tableItems = computed (() => {
8181 return props .items ;
@@ -99,6 +99,16 @@ const boundProps = computed(() => {
9999 };
100100});
101101
102+ // -------------------------------------------------- Slot content check //
103+ onMounted (() => {
104+ const slotContentCheck = document .querySelector (` [data-id="vdt-top-id-${props .level }"] ` ) as HTMLElement ;
105+
106+ // ? If slot does not have content, hide the column to avoid unnecessary space //
107+ if (slotContentCheck ?.children .length === 0 ) {
108+ showTopContent .value = false ;
109+ }
110+ });
111+
102112
103113// -------------------------------------------------- Callbacks //
104114function selectAllCallback(val : boolean ) {
You can’t perform that action at this time.
0 commit comments