import { ref, onMounted, onUnmounted, computed, nextTick } from 'vue'
const boxRef = ref()
const searchBoxRef = ref()
const tableBoxHeight = ref(0)
const computedTableBoxHeight = () => {
const searchBoxHeight = searchBoxRef.value.clientHeight // 获取DIV的高度
const boxHeight = boxRef.value.clientHeight
tableBoxHeight.value = boxHeight - searchBoxHeight - 10
}
const packUp = async () => {
showSearchItem.value = !showSearchItem.value
await nextTick()
computedTableBoxHeight()
}
onMounted(() => {
computedTableBoxHeight()
window.addEventListener('resize', resizeWindow)
})
onUnmounted(() => {
window.removeEventListener('resize', resizeWindow)
})
const resizeWindow = () => {
computedTableBoxHeight()
}