Skip to content

The table configures pagination. When the total is 0, the pagination bar will disappear and the height will change. #5342

@xstxhjh

Description

@xstxhjh
  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.7.7

Environment

vue2

Reproduction link

Edit on CodeSandbox

Steps to reproduce

<template>
  <div>
    <a-table :columns="columns" :data-source="data" :pagination="pagination">
    </a-table>

    <hr />
    <hr />
    <hr />

    <a-table :columns="columns" :data-source="dataB" :pagination="pagination">
    </a-table>
  </div>
</template>
<script>
export default {
  data(){
    return {
      data: [],
      dataB: [{id:1}],
      columns: [{
        title: 'id',
        dataIndex: 'id',
        key: 'id',
      },],
      pagination: {
        size: 'small',
        position: 'bottom',
        total: 0,
        pageSize: 10,
        current: 1,
        showSizeChanger: true,
        showQuickJumper: true,
        hideOnSinglePage: false,
        pageSizeOptions: ['5', '10', '20', '30', '40'],
        showTotal(total) {
          console.log(total)
          return `共 ${total} 条`
        }
      }
    }
  },
  methods: {
  },
};
</script>

What is expected?

开启 pagination 后 total 为 0 也能展示分页栏

What is actually happening?

table 配置分页 pagination,当 total 为 0 时 分页栏会消失,高度会发生变化


因为项目的pagination position 都是top,然后为了美观,pagination 左边都会定位放置一个按钮,分页栏消失会导致按钮位置显示错误

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions