perf: move calc heightTable to filter

This commit is contained in:
Javier Segarra 2025-04-02 10:13:12 +02:00
parent 50a8b97be5
commit c099b41e74
2 changed files with 12 additions and 9 deletions

View File

@ -32,6 +32,7 @@ import VnTableOrder from 'src/components/VnTable/VnOrder.vue';
import VnTableFilter from './VnTableFilter.vue'; import VnTableFilter from './VnTableFilter.vue';
import { getColAlign } from 'src/composables/getColAlign'; import { getColAlign } from 'src/composables/getColAlign';
import RightMenu from '../common/RightMenu.vue'; import RightMenu from '../common/RightMenu.vue';
import heightTable from './filters/heightTable';
const arrayData = useArrayData(useAttrs()['data-key']); const arrayData = useArrayData(useAttrs()['data-key']);
const $props = defineProps({ const $props = defineProps({
@ -117,15 +118,7 @@ const $props = defineProps({
}, },
tableHeight: { tableHeight: {
type: String, type: String,
default: () => { default: heightTable,
let height = 100;
Array.from(document.querySelectorAll('[role="toolbar"]'))
.filter((element) => window.getComputedStyle(element).display !== 'none')
.forEach(() => {
height -= 10;
});
return height + 'vh';
},
}, },
footer: { footer: {
type: Boolean, type: Boolean,

View File

@ -0,0 +1,10 @@
export default function () {
let height = 100;
Array.from(document.querySelectorAll('[role="toolbar"]'))
.filter((element) => window.getComputedStyle(element).display !== 'none')
.forEach(() => {
height -= 10;
});
console.error(height);
return height + 'vh';
}