Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
B
basic-vue-admin
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
Basic
basic-vue-admin
Commits
a2c89d2e
提交
a2c89d2e
authored
1月 04, 2021
作者:
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(table): fix table setting error #162
上级
a7a8b894
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
35 行增加
和
8 行删除
+35
-8
BasicTable.vue
src/components/Table/src/BasicTable.vue
+9
-1
ColumnSetting.vue
...omponents/Table/src/components/settings/ColumnSetting.vue
+4
-5
usePagination.tsx
src/components/Table/src/hooks/usePagination.tsx
+14
-2
useTable.ts
src/components/Table/src/hooks/useTable.ts
+6
-0
table.ts
src/components/Table/src/types/table.ts
+2
-0
没有找到文件。
src/components/Table/src/BasicTable.vue
浏览文件 @
a2c89d2e
...
...
@@ -102,7 +102,13 @@
});
const
{
getLoading
,
setLoading
}
=
useLoading
(
getProps
);
const
{
getPaginationInfo
,
getPagination
,
setPagination
}
=
usePagination
(
getProps
);
const
{
getPaginationInfo
,
getPagination
,
setPagination
,
setShowPagination
,
getShowPagination
,
}
=
usePagination
(
getProps
);
const
{
getRowSelection
,
...
...
@@ -229,6 +235,8 @@
getCacheColumns
,
emit
,
updateTableData
,
setShowPagination
,
getShowPagination
,
getSize
:
()
=>
{
return
unref
(
getBindValues
).
size
as
SizeType
;
},
...
...
src/components/Table/src/components/settings/ColumnSetting.vue
浏览文件 @
a2c89d2e
...
...
@@ -211,18 +211,17 @@
cachePlainOptions
.
value
=
columns
;
state
.
defaultCheckList
=
checkList
;
}
else
{
const
fixedColumns
=
columns
.
filter
((
item
)
=>
Reflect
.
has
(
item
,
'fixed'
)
)
as
BasicColumn
[];
//
const fixedColumns = columns.filter((item) =>
//
Reflect.has(item, 'fixed')
//
) as BasicColumn[];
unref
(
plainOptions
).
forEach
((
item
:
BasicColumn
)
=>
{
const
findItem
=
fixedColumns
.
find
((
fCol
)
=>
fC
ol
.
dataIndex
===
item
.
dataIndex
);
const
findItem
=
columns
.
find
((
col
:
BasicColumn
)
=>
c
ol
.
dataIndex
===
item
.
dataIndex
);
if
(
findItem
)
{
item
.
fixed
=
findItem
.
fixed
;
}
});
}
state
.
checkedList
=
checkList
;
}
...
...
src/components/Table/src/hooks/usePagination.tsx
浏览文件 @
a2c89d2e
...
...
@@ -27,13 +27,16 @@ function itemRender({ page, type, originalElement }: ItemRender) {
export
function
usePagination
(
refProps
:
ComputedRef
<
BasicTableProps
>
)
{
const
configRef
=
ref
<
PaginationProps
>
({});
const
show
=
ref
(
true
);
const
{
t
}
=
useI18n
();
const
getPaginationInfo
=
computed
(():
PaginationProps
|
boolean
=>
{
const
{
pagination
}
=
unref
(
refProps
);
if
(
isBoolean
(
pagination
)
&&
!
pagination
)
{
if
(
!
unref
(
show
)
||
(
isBoolean
(
pagination
)
&&
!
pagination
)
)
{
return
false
;
}
return
{
current
:
1
,
pageSize
:
PAGE_SIZE
,
...
...
@@ -60,5 +63,14 @@ export function usePagination(refProps: ComputedRef<BasicTableProps>) {
function
getPagination
()
{
return
unref
(
getPaginationInfo
);
}
return
{
getPagination
,
getPaginationInfo
,
setPagination
};
function
getShowPagination
()
{
return
unref
(
show
);
}
async
function
setShowPagination
(
flag
:
boolean
)
{
show
.
value
=
flag
;
}
return
{
getPagination
,
getPaginationInfo
,
setShowPagination
,
getShowPagination
,
setPagination
};
}
src/components/Table/src/hooks/useTable.ts
浏览文件 @
a2c89d2e
...
...
@@ -121,6 +121,12 @@ export function useTable(
getForm
:
()
=>
{
return
unref
(
formRef
)
as
FormActionType
;
},
setShowPagination
:
async
(
show
:
boolean
)
=>
{
getTableInstance
().
setShowPagination
(
show
);
},
getShowPagination
:
()
=>
{
return
getTableInstance
().
getShowPagination
();
},
};
return
[
register
,
methods
];
...
...
src/components/Table/src/types/table.ts
浏览文件 @
a2c89d2e
...
...
@@ -102,6 +102,8 @@ export interface TableActionType {
getCacheColumns
:
()
=>
BasicColumn
[];
emit
?:
EmitType
;
updateTableData
:
(
index
:
number
,
key
:
string
,
value
:
any
)
=>
Recordable
;
setShowPagination
:
(
show
:
boolean
)
=>
Promise
<
void
>
;
getShowPagination
:
()
=>
boolean
;
}
export
interface
FetchSetting
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论