Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a44ff73d
authored
Dec 19, 2024
by
Netfan
Committed by
GitHub
Dec 19, 2024
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: grid tools in toolbar config not working as expected (#5190)
1 parent
acd87b22
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue
View file @
a44ff73
...
@@ -6,6 +6,7 @@ import type {
...
@@ -6,6 +6,7 @@ import type {
VxeGridListeners
,
VxeGridListeners
,
VxeGridPropTypes
,
VxeGridPropTypes
,
VxeGridProps
as
VxeTableGridProps
,
VxeGridProps
as
VxeTableGridProps
,
VxeToolbarPropTypes
,
}
from
'vxe-table'
;
}
from
'vxe-table'
;
import
type
{
ExtendedVxeGridApi
,
VxeGridProps
}
from
'./types'
;
import
type
{
ExtendedVxeGridApi
,
VxeGridProps
}
from
'./types'
;
...
@@ -107,28 +108,28 @@ const showToolbar = computed(() => {
...
@@ -107,28 +108,28 @@ const showToolbar = computed(() => {
const
toolbarOptions
=
computed
(()
=>
{
const
toolbarOptions
=
computed
(()
=>
{
const
slotActions
=
slots
[
TOOLBAR_ACTIONS
]?.();
const
slotActions
=
slots
[
TOOLBAR_ACTIONS
]?.();
const
slotTools
=
slots
[
TOOLBAR_TOOLS
]?.();
const
slotTools
=
slots
[
TOOLBAR_TOOLS
]?.();
const
searchBtn
:
VxeToolbarPropTypes
.
ToolConfig
=
{
const
toolbarConfig
:
VxeGridPropTypes
.
ToolbarConfig
=
{
tools
:
gridOptions
.
value
?.
toolbarConfig
?.
search
&&
!!
formOptions
.
value
?
[
{
code
:
'search'
,
code
:
'search'
,
icon
:
'vxe-icon--search'
,
icon
:
'vxe-icon--search'
,
circle
:
true
,
circle
:
true
,
status
:
showSearchForm
.
value
?
'primary'
:
undefined
,
status
:
showSearchForm
.
value
?
'primary'
:
undefined
,
title
:
$t
(
'common.search'
),
title
:
$t
(
'common.search'
),
},
]
:
[],
};
};
// 将搜索按钮合并到用户配置的toolbarConfig.tools中
const
toolbarConfig
:
VxeGridPropTypes
.
ToolbarConfig
=
{
tools
:
(
gridOptions
.
value
?.
toolbarConfig
?.
tools
??
[])
as
VxeToolbarPropTypes
.
ToolConfig
[],
};
if
(
gridOptions
.
value
?.
toolbarConfig
?.
search
&&
!!
formOptions
.
value
)
{
toolbarConfig
.
tools
=
Array
.
isArray
(
toolbarConfig
.
tools
)
?
[...
toolbarConfig
.
tools
,
searchBtn
]
:
[
searchBtn
];
}
if
(
!
showToolbar
.
value
)
{
if
(
!
showToolbar
.
value
)
{
return
{
toolbarConfig
};
return
{
toolbarConfig
};
}
}
// if (gridOptions.value?.toolbarConfig?.search) {
// }
// 强制使用固定的toolbar配置,不允许用户自定义
// 强制使用固定的toolbar配置,不允许用户自定义
// 减少配置的复杂度,以及后续维护的成本
// 减少配置的复杂度,以及后续维护的成本
toolbarConfig
.
slots
=
{
toolbarConfig
.
slots
=
{
...
@@ -137,7 +138,6 @@ const toolbarOptions = computed(() => {
...
@@ -137,7 +138,6 @@ const toolbarOptions = computed(() => {
:
{}),
:
{}),
...(
slotTools
?
{
tools
:
TOOLBAR_TOOLS
}
:
{}),
...(
slotTools
?
{
tools
:
TOOLBAR_TOOLS
}
:
{}),
};
};
return
{
toolbarConfig
};
return
{
toolbarConfig
};
});
});
...
@@ -147,7 +147,7 @@ const options = computed(() => {
...
@@ -147,7 +147,7 @@ const options = computed(() => {
const
mergedOptions
:
VxeTableGridProps
=
cloneDeep
(
const
mergedOptions
:
VxeTableGridProps
=
cloneDeep
(
mergeWithArrayOverride
(
mergeWithArrayOverride
(
{},
{},
to
olbarOptions
.
value
,
to
Raw
(
toolbarOptions
.
value
)
,
toRaw
(
gridOptions
.
value
),
toRaw
(
gridOptions
.
value
),
globalGridConfig
,
globalGridConfig
,
),
),
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment