mirror of
https://gitee.com/lab1024/smart-admin.git
synced 2025-09-17 19:06:39 +08:00
Pre Merge pull request !66 from luoyangxin/master
This commit is contained in:
commit
29d3621ab9
@ -498,9 +498,7 @@
|
||||
|
||||
// 动态设置表格高度
|
||||
const yHeight = ref(0);
|
||||
onMounted(() => {
|
||||
resetGetHeight();
|
||||
});
|
||||
|
||||
function resetGetHeight() {
|
||||
// 搜索部分高度
|
||||
let doc = document.querySelector('.ant-form');
|
||||
@ -517,10 +515,20 @@
|
||||
yHeight.value = box.offsetHeight - dueHeight;
|
||||
}, 100);
|
||||
}
|
||||
window.addEventListener(
|
||||
'resize',
|
||||
_.throttle(() => {
|
||||
|
||||
// 定义一个变量来存储节流后的回调函数
|
||||
let throttledResizeHandler;
|
||||
onMounted(() => {
|
||||
resetGetHeight();
|
||||
}, 1000)
|
||||
);
|
||||
throttledResizeHandler = _.throttle(() => {
|
||||
resetGetHeight();
|
||||
}, 1000);
|
||||
|
||||
window.addEventListener('resize', throttledResizeHandler);
|
||||
});
|
||||
|
||||
// 在组件销毁时移除 resize 事件监听器
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('resize', throttledResizeHandler);
|
||||
});
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user