surely-vue / surely-table

Performant advanced table component

Home Page:https://www.surely.cool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pagination配置项pageSize修改时页码重置问题

shenszy opened this issue · comments

页面点击修改每页条数时,页码不会重置;在代码里面将current强制重置为1后会再次触发change事件,此时触发的change事件中page值不是强制重置的值,而是之前点击页码改变时的值。
代码如下:

const pagination = ref<STablePaginationConfig>({
      showTotal: total => `共 ${total} 条`,
      current: 1,
      pageSize: 10,
      total: 0,
      pageSizeOptions: ['10', '20', '30', '50', '100'],
      onChange: (page: any, pageSize: any) => {
        console.log('page:', page);
        if (pagination.value.pageSize !== pageSize) {
          pagination.value.pageSize = pageSize;
          pagination.value.current = 1;
        } else {
          pagination.value.current = page;
        }
        getUserList(false);
      },
    });

执行结果:
image
image

测试强制重置没有触发change啊,翻页底层是 antdv,我用 ant-design-vue@4.0.0 测试重置没有触发 change
你可以提交可复现问题的在线示例