Skip to content

Commit

Permalink
fix(table): support change event
Browse files Browse the repository at this point in the history
修复表格不支持change事件的问题。

fix #677
  • Loading branch information
mynetfan committed May 30, 2021
1 parent 035f55a commit 9f4d171
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 8 additions & 2 deletions src/components/Table/src/BasicTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
'edit-row-end',
'edit-change',
'expanded-rows-change',
'change',
],
setup(props, { attrs, emit, slots }) {
const tableElRef = ref<ComponentRef>(null);
Expand Down Expand Up @@ -116,7 +117,7 @@
} = useRowSelection(getProps, tableData, emit);
const {
handleTableChange,
handleTableChange: onTableChange,
getDataSourceRef,
getDataSource,
setTableData,
Expand All @@ -138,6 +139,11 @@
emit
);
function handleTableChange(...args) {
onTableChange.call(undefined, ...args);
emit('change', ...args);
}
const {
getViewColumns,
getColumns,
Expand Down Expand Up @@ -204,7 +210,7 @@
propsData = omit(propsData, 'scroll');
}
propsData = omit(propsData, 'class');
propsData = omit(propsData, ['class', 'onChange']);
return propsData;
});
Expand Down
6 changes: 5 additions & 1 deletion src/views/demo/table/UseTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
<BasicTable @register="registerTable" @change="onChange" />
</div>
</template>
<script lang="ts">
Expand All @@ -28,6 +28,9 @@
components: { BasicTable },
setup() {
const { createMessage } = useMessage();
function onChange() {
console.log('onChange', arguments);
}
const [
registerTable,
{
Expand Down Expand Up @@ -121,6 +124,7 @@
getSelectRowKeyList,
setSelectedRowKeyList,
clearSelect,
onChange,
};
},
});
Expand Down

0 comments on commit 9f4d171

Please sign in to comment.