Breadcrumbs: emit 'navigate' event when clicking on the link

Clicking on the breadcrumb link now doesn't follow the link any more,
but by keeping it as a link users can still open in a new tab.
This commit is contained in:
Sybren A. Stüvel 2019-03-28 16:37:46 +01:00
parent d5a4c247b0
commit 1fd17303a5

View File

@ -2,7 +2,7 @@ const TEMPLATE = `
<div class='breadcrumbs' v-if="breadcrumbs.length">
<ul>
<li v-for="crumb in breadcrumbs">
<a :href="crumb.url" v-if="!crumb._self">{{ crumb.name }}</a>
<a :href="crumb.url" v-if="!crumb._self" @click.prevent="navigateToNode(crumb._id)">{{ crumb.name }}</a>
<template v-else><span>{{ crumb.name }}</span></template>
</li>
</ul>
@ -45,5 +45,8 @@ Vue.component("node-breadcrumbs", {
})
;
},
navigateToNode(nodeId) {
this.$emit('navigate', nodeId);
},
},
});