Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
b6396503
Unverified
提交
b6396503
authored
12月 18, 2021
作者:
lzdjack
提交者:
GitHub
12月 18, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 修复table自适应高度和title属性声明问题 (#1496)
1.修复table升级ant3.0导致无法自适应剩余高度 2.修复table升级ant3.0导致BasicColumn类型的title属性无法找到
上级
9217a12b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
7 行增加
和
13 行删除
+7
-13
useTableFooter.ts
src/components/Table/src/hooks/useTableFooter.ts
+1
-1
useTableScroll.ts
src/components/Table/src/hooks/useTableScroll.ts
+4
-8
table.ts
src/components/Table/src/types/table.ts
+2
-4
没有找到文件。
src/components/Table/src/hooks/useTableFooter.ts
浏览文件 @
b6396503
...
@@ -8,7 +8,7 @@ export function useTableFooter(
...
@@ -8,7 +8,7 @@ export function useTableFooter(
propsRef
:
ComputedRef
<
BasicTableProps
>
,
propsRef
:
ComputedRef
<
BasicTableProps
>
,
scrollRef
:
ComputedRef
<
{
scrollRef
:
ComputedRef
<
{
x
:
string
|
number
|
true
;
x
:
string
|
number
|
true
;
y
:
Nullable
<
number
>
;
y
:
string
|
number
|
null
;
scrollToFirstRowOnChange
:
boolean
;
scrollToFirstRowOnChange
:
boolean
;
}
>
,
}
>
,
tableElRef
:
Ref
<
ComponentRef
>
,
tableElRef
:
Ref
<
ComponentRef
>
,
...
...
src/components/Table/src/hooks/useTableScroll.ts
浏览文件 @
b6396503
import
type
{
BasicTableProps
,
TableRowSelection
,
BasicColumn
}
from
'../types/table'
;
import
type
{
BasicTableProps
,
TableRowSelection
,
BasicColumn
}
from
'../types/table'
;
import
type
{
Ref
,
ComputedRef
}
from
'vue'
;
import
type
{
Ref
,
ComputedRef
}
from
'vue'
;
import
{
computed
,
unref
,
ref
,
nextTick
,
watch
}
from
'vue'
;
import
{
computed
,
unref
,
nextTick
,
watch
}
from
'vue'
;
import
{
getViewportOffset
}
from
'/@/utils/domUtils'
;
import
{
getViewportOffset
}
from
'/@/utils/domUtils'
;
import
{
isBoolean
}
from
'/@/utils/is'
;
import
{
isBoolean
}
from
'/@/utils/is'
;
import
{
useWindowSizeFn
}
from
'/@/hooks/event/useWindowSizeFn'
;
import
{
useWindowSizeFn
}
from
'/@/hooks/event/useWindowSizeFn'
;
...
@@ -15,8 +15,6 @@ export function useTableScroll(
...
@@ -15,8 +15,6 @@ export function useTableScroll(
rowSelectionRef
:
ComputedRef
<
TableRowSelection
|
null
>
,
rowSelectionRef
:
ComputedRef
<
TableRowSelection
|
null
>
,
getDataSourceRef
:
ComputedRef
<
Recordable
[]
>
,
getDataSourceRef
:
ComputedRef
<
Recordable
[]
>
,
)
{
)
{
const
tableHeightRef
:
Ref
<
Nullable
<
number
>>
=
ref
(
null
);
const
modalFn
=
useModalContext
();
const
modalFn
=
useModalContext
();
// Greater than animation time 280
// Greater than animation time 280
...
@@ -43,8 +41,7 @@ export function useTableScroll(
...
@@ -43,8 +41,7 @@ export function useTableScroll(
});
});
}
}
function
setHeight
(
height
:
number
)
{
function
setHeight
()
{
tableHeightRef
.
value
=
height
;
// Solve the problem of modal adaptive height calculation when the form is placed in the modal
// Solve the problem of modal adaptive height calculation when the form is placed in the modal
modalFn
?.
redoModalHeight
?.();
modalFn
?.
redoModalHeight
?.();
}
}
...
@@ -141,7 +138,7 @@ export function useTableScroll(
...
@@ -141,7 +138,7 @@ export function useTableScroll(
headerHeight
;
headerHeight
;
height
=
(
height
>
maxHeight
!
?
(
maxHeight
as
number
)
:
height
)
??
height
;
height
=
(
height
>
maxHeight
!
?
(
maxHeight
as
number
)
:
height
)
??
height
;
setHeight
(
height
);
setHeight
();
bodyEl
!
.
style
.
height
=
`
${
height
}
px`
;
bodyEl
!
.
style
.
height
=
`
${
height
}
px`
;
}
}
...
@@ -179,11 +176,10 @@ export function useTableScroll(
...
@@ -179,11 +176,10 @@ export function useTableScroll(
});
});
const
getScrollRef
=
computed
(()
=>
{
const
getScrollRef
=
computed
(()
=>
{
const
tableHeight
=
unref
(
tableHeightRef
);
const
{
canResize
,
scroll
}
=
unref
(
propsRef
);
const
{
canResize
,
scroll
}
=
unref
(
propsRef
);
return
{
return
{
x
:
unref
(
getScrollX
),
x
:
unref
(
getScrollX
),
y
:
canResize
?
tableHeight
:
null
,
y
:
canResize
?
'100%'
:
null
,
scrollToFirstRowOnChange
:
false
,
scrollToFirstRowOnChange
:
false
,
...
scroll
,
...
scroll
,
};
};
...
...
src/components/Table/src/types/table.ts
浏览文件 @
b6396503
import
type
{
VNodeChild
}
from
'vue'
;
import
type
{
VNodeChild
}
from
'vue'
;
import
type
{
PaginationProps
}
from
'./pagination'
;
import
type
{
PaginationProps
}
from
'./pagination'
;
import
type
{
FormProps
}
from
'/@/components/Form'
;
import
type
{
FormProps
}
from
'/@/components/Form'
;
import
type
{
import
type
{
TableRowSelection
as
ITableRowSelection
}
from
'ant-design-vue/lib/table/interface'
;
ColumnProps
,
import
type
{
ColumnProps
}
from
'ant-design-vue/lib/table'
;
TableRowSelection
as
ITableRowSelection
,
}
from
'ant-design-vue/lib/table/interface'
;
import
{
ComponentType
}
from
'./componentType'
;
import
{
ComponentType
}
from
'./componentType'
;
import
{
VueNode
}
from
'/@/utils/propTypes'
;
import
{
VueNode
}
from
'/@/utils/propTypes'
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论