Skip to content

Pagination分页组件total参数使用变量,且默认值为0时,页面渲染后当前页不是选中状态,改变分页大小,控制台输出当前页,显示为0。 #2000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
mwdu opened this issue Apr 1, 2020 · 2 comments
Labels

Comments

@mwdu
Copy link

mwdu commented Apr 1, 2020

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

Version

1.5.0

Environment

Windows10,Chrome 80.0.3987.149,Vue 2.6.10

Reproduction link

https://www.antdv.com/components/pagination-cn/

Steps to reproduce

<template>
<div style="margin-top:300px;margin-left:50px;">
<a-pagination
showSizeChanger
:pageSize.sync="pageSize"
@showSizeChange="onShowSizeChange"
:total="total"
v-model="current"
/>
</div>
</template>

<script>
export default {
name: "templateMgr",
data() {
return {
pageSize: 20,
current: 1,
total: 0
};
},
mounted() {
this.getData();
},
methods: {
onShowSizeChange(current, pageSize) {
console.log(current, pageSize);
},
getData() {
this.total = 200;
}
}
};
</script>

<style lang="less" scoped></style>

What is expected?

分页页码1应处于选中状态,并且选择更改pageSize下拉选择框时,控制台输出的current变量值应与当前页一致。

What is actually happening?

分页页码1未处于选中状态,更改pageSize,控制台输出的current变量值为0。


本例中将mounted钩子函数改为created,则可以运行正常。但若getData方法中改变this.total变量值操作处于异步操作环境中,分页页码默认选中状态时好时坏。

@tangjinzhou
Copy link
Member

duplicate #1989

@github-actions
Copy link

github-actions bot commented Apr 3, 2021

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants