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
9f4d1719
Commit
9f4d1719
authored
May 30, 2021
by
无木
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(table): support change event
修复表格不支持change事件的问题。 fix #677
parent
035f55af
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
BasicTable.vue
src/components/Table/src/BasicTable.vue
+8
-2
UseTable.vue
src/views/demo/table/UseTable.vue
+5
-1
No files found.
src/components/Table/src/BasicTable.vue
View file @
9f4d1719
...
@@ -81,6 +81,7 @@
...
@@ -81,6 +81,7 @@
'
edit-row-end
'
,
'
edit-row-end
'
,
'
edit-change
'
,
'
edit-change
'
,
'
expanded-rows-change
'
,
'
expanded-rows-change
'
,
'
change
'
,
],
],
setup
(
props
,
{
attrs
,
emit
,
slots
})
{
setup
(
props
,
{
attrs
,
emit
,
slots
})
{
const
tableElRef
=
ref
<
ComponentRef
>
(
null
);
const
tableElRef
=
ref
<
ComponentRef
>
(
null
);
...
@@ -116,7 +117,7 @@
...
@@ -116,7 +117,7 @@
}
=
useRowSelection
(
getProps
,
tableData
,
emit
);
}
=
useRowSelection
(
getProps
,
tableData
,
emit
);
const
{
const
{
handleTableChange
,
handleTableChange
:
onTableChange
,
getDataSourceRef
,
getDataSourceRef
,
getDataSource
,
getDataSource
,
setTableData
,
setTableData
,
...
@@ -138,6 +139,11 @@
...
@@ -138,6 +139,11 @@
emit
emit
);
);
function
handleTableChange
(...
args
)
{
onTableChange
.
call
(
undefined
,
...
args
);
emit
(
'
change
'
,
...
args
);
}
const
{
const
{
getViewColumns
,
getViewColumns
,
getColumns
,
getColumns
,
...
@@ -204,7 +210,7 @@
...
@@ -204,7 +210,7 @@
propsData
=
omit
(
propsData
,
'
scroll
'
);
propsData
=
omit
(
propsData
,
'
scroll
'
);
}
}
propsData
=
omit
(
propsData
,
'
class
'
);
propsData
=
omit
(
propsData
,
[
'
class
'
,
'
onChange
'
]
);
return
propsData
;
return
propsData
;
});
});
...
...
src/views/demo/table/UseTable.vue
View file @
9f4d1719
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
<a-button
class=
"mr-2"
@
click=
"clearSelect"
>
清空选中行
</a-button>
<a-button
class=
"mr-2"
@
click=
"clearSelect"
>
清空选中行
</a-button>
<a-button
class=
"mr-2"
@
click=
"getPagination"
>
获取分页信息
</a-button>
<a-button
class=
"mr-2"
@
click=
"getPagination"
>
获取分页信息
</a-button>
</div>
</div>
<BasicTable
@
register=
"registerTable"
/>
<BasicTable
@
register=
"registerTable"
@
change=
"onChange"
/>
</div>
</div>
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
...
@@ -28,6 +28,9 @@
...
@@ -28,6 +28,9 @@
components
:
{
BasicTable
},
components
:
{
BasicTable
},
setup
()
{
setup
()
{
const
{
createMessage
}
=
useMessage
();
const
{
createMessage
}
=
useMessage
();
function
onChange
()
{
console
.
log
(
'
onChange
'
,
arguments
);
}
const
[
const
[
registerTable
,
registerTable
,
{
{
...
@@ -121,6 +124,7 @@
...
@@ -121,6 +124,7 @@
getSelectRowKeyList
,
getSelectRowKeyList
,
setSelectedRowKeyList
,
setSelectedRowKeyList
,
clearSelect
,
clearSelect
,
onChange
,
};
};
},
},
});
});
...
...
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