Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
6095cb54
提交
6095cb54
authored
3月 10, 2021
作者:
Vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(table): ensure that the height calculation is normal close #349
上级
2c6aa852
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
16 行增加
和
14 行删除
+16
-14
useTableScroll.ts
src/components/Table/src/hooks/useTableScroll.ts
+16
-14
没有找到文件。
src/components/Table/src/hooks/useTableScroll.ts
浏览文件 @
6095cb54
...
@@ -23,7 +23,7 @@ export function useTableScroll(
...
@@ -23,7 +23,7 @@ export function useTableScroll(
const
modalFn
=
useModalContext
();
const
modalFn
=
useModalContext
();
// Greater than animation time 280
// Greater than animation time 280
const
[
debounceRedoHeight
]
=
useDebounce
(
redoHeight
,
2
00
);
const
[
debounceRedoHeight
]
=
useDebounce
(
redoHeight
,
1
00
);
const
getCanResize
=
computed
(()
=>
{
const
getCanResize
=
computed
(()
=>
{
const
{
canResize
,
scroll
}
=
unref
(
propsRef
);
const
{
canResize
,
scroll
}
=
unref
(
propsRef
);
...
@@ -41,11 +41,9 @@ export function useTableScroll(
...
@@ -41,11 +41,9 @@ export function useTableScroll(
);
);
function
redoHeight
()
{
function
redoHeight
()
{
if
(
unref
(
getCanResize
))
{
nextTick
(()
=>
{
nextTick
(()
=>
{
calcTableHeight
();
calcTableHeight
();
});
});
}
}
}
function
setHeight
(
heigh
:
number
)
{
function
setHeight
(
heigh
:
number
)
{
...
@@ -63,15 +61,23 @@ export function useTableScroll(
...
@@ -63,15 +61,23 @@ export function useTableScroll(
const
{
resizeHeightOffset
,
pagination
,
maxHeight
}
=
unref
(
propsRef
);
const
{
resizeHeightOffset
,
pagination
,
maxHeight
}
=
unref
(
propsRef
);
const
tableData
=
unref
(
getDataSourceRef
);
const
tableData
=
unref
(
getDataSourceRef
);
if
(
!
unref
(
getCanResize
)
||
tableData
.
length
===
0
)
return
;
await
nextTick
();
//Add a delay to get the correct bottomIncludeBody paginationHeight footerHeight headerHeight
const
table
=
unref
(
tableElRef
);
const
table
=
unref
(
tableElRef
);
if
(
!
table
)
return
;
if
(
!
table
)
return
;
const
tableEl
:
Element
=
table
.
$el
;
const
tableEl
:
Element
=
table
.
$el
;
if
(
!
tableEl
)
return
;
if
(
!
tableEl
)
return
;
if
(
!
bodyEl
)
{
bodyEl
=
tableEl
.
querySelector
(
'.ant-table-body'
);
}
bodyEl
!
.
style
.
height
=
'unset'
;
if
(
!
unref
(
getCanResize
)
||
tableData
.
length
===
0
)
return
;
await
nextTick
();
//Add a delay to get the correct bottomIncludeBody paginationHeight footerHeight headerHeight
const
headEl
=
tableEl
.
querySelector
(
'.ant-table-thead '
);
const
headEl
=
tableEl
.
querySelector
(
'.ant-table-thead '
);
if
(
!
headEl
)
return
;
if
(
!
headEl
)
return
;
...
@@ -124,10 +130,6 @@ export function useTableScroll(
...
@@ -124,10 +130,6 @@ export function useTableScroll(
height
=
(
height
>
maxHeight
!
?
(
maxHeight
as
number
)
:
height
)
??
height
;
height
=
(
height
>
maxHeight
!
?
(
maxHeight
as
number
)
:
height
)
??
height
;
setHeight
(
height
);
setHeight
(
height
);
if
(
!
bodyEl
)
{
bodyEl
=
tableEl
.
querySelector
(
'.ant-table-body'
);
}
bodyEl
!
.
style
.
height
=
`
${
height
}
px`
;
bodyEl
!
.
style
.
height
=
`
${
height
}
px`
;
}
}
useWindowSizeFn
(
calcTableHeight
,
280
);
useWindowSizeFn
(
calcTableHeight
,
280
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论