Skip to content

Commit

Permalink
[link] fix click event
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed May 9, 2017
1 parent 0ac5356 commit 45362fb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/mixins/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
export default {
computed: {
isRouterLink() {
return this.$router && this.to && !this.disabled;
return Boolean(this.$router && this.to && !this.disabled);
},
_href() {
if (this.disabled) {
Expand Down Expand Up @@ -74,13 +74,12 @@ export default {
},
methods: {
linkClick(e) {
if (this.disabled || this._href === '#') {
this.$root.$emit('clicked::link', this);

if (this.disabled || (!this.isRouterLink && this._href === '#')) {
e.preventDefault();
e.stopPropagation();
return;
}

this.$root.$emit('clicked::link', this);
}
}
}

0 comments on commit 45362fb

Please sign in to comment.