fix page navigation
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
<g-link
|
<g-link
|
||||||
class="page-navigation__link"
|
class="page-navigation__link"
|
||||||
exact
|
exact
|
||||||
:to="nextPage.link"
|
:to="nextPage.redirect || nextPage.link"
|
||||||
v-if="nextPage"
|
v-if="nextPage"
|
||||||
>
|
>
|
||||||
{{ nextPage.title }} →
|
{{ nextPage.title }} →
|
||||||
@@ -41,10 +41,11 @@ export default {
|
|||||||
flattenedItems() {
|
flattenedItems() {
|
||||||
const flattenedItems = []
|
const flattenedItems = []
|
||||||
|
|
||||||
this.items.forEach(({ title, link, items }) => {
|
this.items.forEach(({ title, link, redirect, items }) => {
|
||||||
flattenedItems.push({
|
flattenedItems.push({
|
||||||
title,
|
title,
|
||||||
link,
|
link,
|
||||||
|
redirect,
|
||||||
})
|
})
|
||||||
|
|
||||||
if (items) {
|
if (items) {
|
||||||
@@ -68,7 +69,13 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
previousPage() {
|
previousPage() {
|
||||||
return this.flattenedItems[this.currentIndex - 1]
|
let previousIndex = this.currentIndex - 1
|
||||||
|
|
||||||
|
while (this.flattenedItems[previousIndex].redirect) {
|
||||||
|
previousIndex -= 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.flattenedItems[previousIndex]
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user