提交 9f4d1719 编写于 作者: 无木

fix(table): support change event

修复表格不支持change事件的问题。

fix #677
上级 035f55af
......@@ -81,6 +81,7 @@
'edit-row-end',
'edit-change',
'expanded-rows-change',
'change',
],
setup(props, { attrs, emit, slots }) {
const tableElRef = ref<ComponentRef>(null);
......@@ -116,7 +117,7 @@
} = useRowSelection(getProps, tableData, emit);
const {
handleTableChange,
handleTableChange: onTableChange,
getDataSourceRef,
getDataSource,
setTableData,
......@@ -138,6 +139,11 @@
emit
);
function handleTableChange(...args) {
onTableChange.call(undefined, ...args);
emit('change', ...args);
}
const {
getViewColumns,
getColumns,
......@@ -204,7 +210,7 @@
propsData = omit(propsData, 'scroll');
}
propsData = omit(propsData, 'class');
propsData = omit(propsData, ['class', 'onChange']);
return propsData;
});
......
......@@ -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">
......@@ -28,6 +28,9 @@
components: { BasicTable },
setup() {
const { createMessage } = useMessage();
function onChange() {
console.log('onChange', arguments);
}
const [
registerTable,
{
......@@ -121,6 +124,7 @@
getSelectRowKeyList,
setSelectedRowKeyList,
clearSelect,
onChange,
};
},
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册