Skip to content

Commit 7a4b41d

Browse files
authored
href prop isnt needed if object in to prop
If you use an object in to prop without using the href prop (for example if you use named routes) you will get href="http://github.com/[object%20Object]" in your html. My pullrequest will fix this.
1 parent 547abec commit 7a4b41d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

components/nav-item.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<component
44
:class="classObject"
55
@click="onclick"
6-
:href="href || to"
6+
:href="hrefString"
77
:is="componentType"
88
active-class="active"
99
:to="to"
@@ -28,6 +28,9 @@
2828
},
2929
componentType() {
3030
return this.to ? 'router-link' : 'a';
31+
},
32+
hrefString() {
33+
return typeof this.to === 'object' ? this.href || undefined : this.href || this.to;
3134
}
3235
},
3336
props: {

0 commit comments

Comments
 (0)