Skip to content

Commit

Permalink
[NavItem] Change the component type to 'button' if 'href' or 'to' pro…
Browse files Browse the repository at this point in the history
…ps are not defined
  • Loading branch information
cynecx committed Apr 12, 2017
1 parent 2beebcd commit 1518011
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/components/nav-item.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<li class="nav-item" @click="onclick">
<b-link :class="classObject" :to="to" :href="href" :exact="exact">
<b-link :is="itemType" :class="classObject" :to="to" :href="href" :exact="exact">
<slot></slot>
</b-link>
</li>
Expand All @@ -12,6 +12,9 @@
export default {
components: {bLink},
computed: {
itemType() {
return (this.href || this.to) ? 'b-link' : 'button';
},
classObject() {
return [
'nav-link',
Expand Down

0 comments on commit 1518011

Please sign in to comment.