Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Lucky高
vue-vben-admin
提交
a2c89d2e
V
vue-vben-admin
项目概览
Lucky高
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a2c89d2e
编写于
1月 04, 2021
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(table): fix table setting error #162
上级
a7a8b894
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
35 addition
and
8 deletion
+35
-8
src/components/Table/src/BasicTable.vue
src/components/Table/src/BasicTable.vue
+9
-1
src/components/Table/src/components/settings/ColumnSetting.vue
...omponents/Table/src/components/settings/ColumnSetting.vue
+4
-5
src/components/Table/src/hooks/usePagination.tsx
src/components/Table/src/hooks/usePagination.tsx
+14
-2
src/components/Table/src/hooks/useTable.ts
src/components/Table/src/hooks/useTable.ts
+6
-0
src/components/Table/src/types/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
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录