修复分页逻辑

master
yutent 2023-11-15 11:22:10 +08:00
parent 10c3b134e2
commit 1b9a5da750
1 changed files with 4 additions and 1 deletions

View File

@ -94,7 +94,7 @@ class Pager extends Component {
default: 0, default: 0,
attribute: false, attribute: false,
observer(v) { observer(v) {
this.totalpage = Math.ceil(v / this.pagesize) this.totalpage = Math.ceil(v / this.pagesize) || 1
} }
}, },
totalpage: { totalpage: {
@ -102,6 +102,9 @@ class Pager extends Component {
default: 1, default: 1,
attribute: false, attribute: false,
observer(v) { observer(v) {
if (v < 1) {
v = 1
}
if (this.page > v) { if (this.page > v) {
this.page = v this.page = v
} }