fixed prev next links in article page for new route using id

This commit is contained in:
Bachir Soussi Chiadmi 2021-03-08 15:01:09 +01:00
parent d4957ad19a
commit 488447fbe1
2 changed files with 10 additions and 10 deletions

File diff suppressed because one or more lines are too long

View File

@ -10,7 +10,7 @@
v-if="prevnext.prev"
:href="prevnext.prev.view_node"
v-html="prevnext.prev.title"
@click.prevent="onPrevNext(prevnext.prev.view_node)"
@click.prevent="onPrevNext(prevnext.prev)"
/>
</li>
<li>
@ -18,7 +18,7 @@
v-if="prevnext.next"
:href="prevnext.next.view_node"
v-html="prevnext.next.title"
@click.prevent="onPrevNext(prevnext.next.view_node)"
@click.prevent="onPrevNext(prevnext.next)"
/>
</li>
</ul>
@ -98,7 +98,7 @@
v-if="prevnext.prev"
:href="prevnext.prev.view_node"
v-html="prevnext.prev.title"
@click.prevent="onPrevNext(prevnext.prev.view_node)"
@click.prevent="onPrevNext(prevnext.prev)"
/>
</li>
<li>
@ -106,7 +106,7 @@
v-if="prevnext.next"
:href="prevnext.next.view_node"
v-html="prevnext.next.title"
@click.prevent="onPrevNext(prevnext.next.view_node)"
@click.prevent="onPrevNext(prevnext.next)"
/>
</li>
</ul>
@ -284,14 +284,14 @@ export default {
this.loading = false;
},
onPrevNext(a){
console.log('clicked on prev/next; a', a);
let alias = a.replace(/^\/\D{2,3}\/blabla\//g, '')
onPrevNext(pn){
console.log('clicked on prev/next; prevnext', pn);
let alias = pn.view_node.replace(/^\/\D{2,3}\/blabla\//g, '')
console.log('alias', alias);
this.$router.push({
name:`article`,
params: { alias:alias }
params: { alias:alias, id: pn.nid }
})
},
setLightboxIndex(index) {