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:
@@ -2,7 +2,7 @@ const TEMPLATE = `
|
|||||||
<div class='breadcrumbs' v-if="breadcrumbs.length">
|
<div class='breadcrumbs' v-if="breadcrumbs.length">
|
||||||
<ul>
|
<ul>
|
||||||
<li v-for="crumb in breadcrumbs">
|
<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>
|
<template v-else><span>{{ crumb.name }}</span></template>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@@ -45,5 +45,8 @@ Vue.component("node-breadcrumbs", {
|
|||||||
})
|
})
|
||||||
;
|
;
|
||||||
},
|
},
|
||||||
|
navigateToNode(nodeId) {
|
||||||
|
this.$emit('navigate', nodeId);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user