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
@ -495,32 +495,40 @@
|
|||||||
function camelToUnderscore(str) {
|
function camelToUnderscore(str) {
|
||||||
return str.replace(/([A-Z])/g, '_$1').toLowerCase();
|
return str.replace(/([A-Z])/g, '_$1').toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 动态设置表格高度
|
// 动态设置表格高度
|
||||||
const yHeight = ref(0);
|
const yHeight = ref(0);
|
||||||
onMounted(() => {
|
|
||||||
resetGetHeight();
|
|
||||||
});
|
|
||||||
function resetGetHeight() {
|
function resetGetHeight() {
|
||||||
// 搜索部分高度
|
// 搜索部分高度
|
||||||
let doc = document.querySelector('.ant-form');
|
let doc = document.querySelector('.ant-form');
|
||||||
// 按钮部分高度
|
// 按钮部分高度
|
||||||
let btn = document.querySelector('.smart-table-btn-block');
|
let btn = document.querySelector('.smart-table-btn-block');
|
||||||
// 表格头高度
|
// 表格头高度
|
||||||
let tableCell = document.querySelector('.ant-table-cell');
|
let tableCell = document.querySelector('.ant-table-cell');
|
||||||
// 分页高度
|
// 分页高度
|
||||||
let page = document.querySelector('.smart-query-table-page');
|
let page = document.querySelector('.smart-query-table-page');
|
||||||
// 内容区总高度
|
// 内容区总高度
|
||||||
let box = document.querySelector('.admin-content');
|
let box = document.querySelector('.admin-content');
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let dueHeight = doc.offsetHeight + 10 + 24 + btn.offsetHeight + 15 + tableCell.offsetHeight + page.offsetHeight + 20;
|
let dueHeight = doc.offsetHeight + 10 + 24 + btn.offsetHeight + 15 + tableCell.offsetHeight + page.offsetHeight + 20;
|
||||||
yHeight.value = box.offsetHeight - dueHeight;
|
yHeight.value = box.offsetHeight - dueHeight;
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
window.addEventListener(
|
|
||||||
'resize',
|
// 定义一个变量来存储节流后的回调函数
|
||||||
_.throttle(() => {
|
let throttledResizeHandler;
|
||||||
resetGetHeight();
|
onMounted(() => {
|
||||||
}, 1000)
|
resetGetHeight();
|
||||||
);
|
throttledResizeHandler = _.throttle(() => {
|
||||||
|
resetGetHeight();
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
|
window.addEventListener('resize', throttledResizeHandler);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 在组件销毁时移除 resize 事件监听器
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener('resize', throttledResizeHandler);
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user