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 89d963c8
authored
Mar 07, 2025
by
Netfan
Committed by
GitHub
Mar 07, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: vxeTable search button not working with slot (#5678)
1 parent
b37ed48b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue
packages/effects/plugins/src/vxe-table/use-vxe-grid.vue
View file @
89d963c
...
@@ -33,6 +33,7 @@ import { cloneDeep, cn, mergeWithArrayOverride } from '@vben/utils';
...
@@ -33,6 +33,7 @@ import { cloneDeep, cn, mergeWithArrayOverride } from '@vben/utils';
import
{
VbenHelpTooltip
,
VbenLoading
}
from
'@vben-core/shadcn-ui'
;
import
{
VbenHelpTooltip
,
VbenLoading
}
from
'@vben-core/shadcn-ui'
;
import
{
VxeButton
}
from
'vxe-pc-ui'
;
import
{
VxeGrid
,
VxeUI
}
from
'vxe-table'
;
import
{
VxeGrid
,
VxeUI
}
from
'vxe-table'
;
import
{
extendProxyOptions
}
from
'./extends'
;
import
{
extendProxyOptions
}
from
'./extends'
;
...
@@ -114,7 +115,7 @@ const toolbarOptions = computed(() => {
...
@@ -114,7 +115,7 @@ const toolbarOptions = computed(() => {
const
slotTools
=
slots
[
TOOLBAR_TOOLS
]?.();
const
slotTools
=
slots
[
TOOLBAR_TOOLS
]?.();
const
searchBtn
:
VxeToolbarPropTypes
.
ToolConfig
=
{
const
searchBtn
:
VxeToolbarPropTypes
.
ToolConfig
=
{
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'
),
...
@@ -200,13 +201,17 @@ const options = computed(() => {
...
@@ -200,13 +201,17 @@ const options = computed(() => {
function
onToolbarToolClick
(
event
:
VxeGridDefines
.
ToolbarToolClickEventParams
)
{
function
onToolbarToolClick
(
event
:
VxeGridDefines
.
ToolbarToolClickEventParams
)
{
if
(
event
.
code
===
'search'
)
{
if
(
event
.
code
===
'search'
)
{
props
.
api
?.
toggleSearchForm
?.
();
onSearchBtnClick
();
}
}
(
(
gridEvents
.
value
?.
toolbarToolClick
as
VxeGridListeners
[
'toolbarToolClick'
]
gridEvents
.
value
?.
toolbarToolClick
as
VxeGridListeners
[
'toolbarToolClick'
]
)?.(
event
);
)?.(
event
);
}
}
function
onSearchBtnClick
()
{
props
.
api
?.
toggleSearchForm
?.();
}
const
events
=
computed
(()
=>
{
const
events
=
computed
(()
=>
{
return
{
return
{
...
gridEvents
.
value
,
...
gridEvents
.
value
,
...
@@ -218,7 +223,11 @@ const delegatedSlots = computed(() => {
...
@@ -218,7 +223,11 @@ const delegatedSlots = computed(() => {
const
resultSlots
:
string
[]
=
[];
const
resultSlots
:
string
[]
=
[];
for
(
const
key
of
Object
.
keys
(
slots
))
{
for
(
const
key
of
Object
.
keys
(
slots
))
{
if
(
!
[
'empty'
,
'form'
,
'loading'
,
TOOLBAR_ACTIONS
].
includes
(
key
))
{
if
(
!
[
'empty'
,
'form'
,
'loading'
,
TOOLBAR_ACTIONS
,
TOOLBAR_TOOLS
].
includes
(
key
,
)
)
{
resultSlots
.
push
(
key
);
resultSlots
.
push
(
key
);
}
}
}
}
...
@@ -344,6 +353,18 @@ onUnmounted(() => {
...
@@ -344,6 +353,18 @@ onUnmounted(() => {
>
>
<slot
:name=
"slotName"
v-bind=
"slotProps"
></slot>
<slot
:name=
"slotName"
v-bind=
"slotProps"
></slot>
</
template
>
</
template
>
<
template
#
toolbar-tools=
"slotProps"
>
<slot
name=
"toolbar-tools"
v-bind=
"slotProps"
></slot>
<VxeButton
icon=
"vxe-icon-search"
circle
class=
"ml-2"
v-if=
"gridOptions?.toolbarConfig?.search && !!formOptions"
:status=
"showSearchForm ? 'primary' : undefined"
:title=
"$t('common.search')"
@
click=
"onSearchBtnClick"
/>
</
template
>
<!-- form表单 -->
<!-- form表单 -->
<
template
#
form
>
<
template
#
form
>
...
...
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