mirror of
https://github.com/hkalexling/Mango.git
synced 2025-08-02 10:55:30 -04:00
Validate input index before flipping page
This commit is contained in:
parent
4a7439a1ea
commit
f51d27860a
@ -101,8 +101,9 @@ const readerComponent = () => {
|
||||
*/
|
||||
flipPage(isNext) {
|
||||
const idx = parseInt(this.curItem.id);
|
||||
const delta = isNext ? 1 : -1;
|
||||
const newIdx = idx + delta;
|
||||
const newIdx = idx + (isNext ? 1 : -1);
|
||||
|
||||
if (newIdx <= 0 || newIdx > this.items.length) return;
|
||||
|
||||
this.toPage(newIdx);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user