Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
najiu-admin-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
najiu-frontend
najiu-admin-template
Commits
9f5085c9
Commit
9f5085c9
authored
May 30, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(table): useTable support onChange
修复useTable无法直接通过设置onChange来注册change事件响应的问题
parent
9f4d1719
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
BasicTable.vue
src/components/Table/src/BasicTable.vue
+4
-0
UseTable.vue
src/views/demo/table/UseTable.vue
+2
-1
No files found.
src/components/Table/src/BasicTable.vue
View file @
9f5085c9
...
...
@@ -58,6 +58,7 @@
import
{
omit
}
from
'
lodash-es
'
;
import
{
basicProps
}
from
'
./props
'
;
import
{
isFunction
}
from
'
/@/utils/is
'
;
export
default
defineComponent
({
components
:
{
...
...
@@ -142,6 +143,9 @@
function
handleTableChange
(...
args
)
{
onTableChange
.
call
(
undefined
,
...
args
);
emit
(
'
change
'
,
...
args
);
// 解决通过useTable注册onChange时不起作用的问题
const
{
onChange
}
=
unref
(
getProps
);
onChange
&&
isFunction
(
onChange
)
&&
onChange
.
call
(
undefined
,
...
args
);
}
const
{
...
...
src/views/demo/table/UseTable.vue
View file @
9f5085c9
...
...
@@ -15,7 +15,7 @@
<a-button
class=
"mr-2"
@
click=
"clearSelect"
>
清空选中行
</a-button>
<a-button
class=
"mr-2"
@
click=
"getPagination"
>
获取分页信息
</a-button>
</div>
<BasicTable
@
register=
"registerTable"
@
change=
"onChange"
/>
<BasicTable
@
register=
"registerTable"
/>
</div>
</
template
>
<
script
lang=
"ts"
>
...
...
@@ -54,6 +54,7 @@
columns
:
getBasicColumns
(),
rowKey
:
'
id
'
,
showTableSetting
:
true
,
onChange
,
rowSelection
:
{
type
:
'
checkbox
'
,
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment