Skip to content

Commit

Permalink
fix(NcButton): use a as tag for router-link
Browse files Browse the repository at this point in the history
Signed-off-by: Raimund Schlüßler <[email protected]>
  • Loading branch information
raimund-schluessler committed Jan 18, 2024
1 parent 077faae commit 4115a85
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/NcButton/NcButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,8 @@ export default {
this)
}
const renderButton = ({ navigate, isActive, isExactActive } = {}) => h((this.to || !this.href) ? 'button' : 'a',
const isLink = (this.to || this.href)
const renderButton = ({ href, navigate, isActive, isExactActive } = {}) => h(isLink ? 'a' : 'button',
{
class: [
'button-vue',
Expand All @@ -633,11 +634,11 @@ export default {
'aria-label': this.ariaLabel,
'aria-pressed': this.pressed,
disabled: this.disabled,
type: this.href ? null : this.nativeType,
role: this.href ? 'button' : null,
href: (!this.to && this.href) ? this.href : null,
target: (!this.to && this.href) ? '_self' : null,
rel: (!this.to && this.href) ? 'nofollow noreferrer noopener' : null,
type: isLink ? null : this.nativeType,
role: isLink ? 'button' : null,
href: this.to ? href : (this.href || null),
target: isLink ? '_self' : null,
rel: isLink ? 'nofollow noreferrer noopener' : null,
download: (!this.to && this.href && this.download) ? this.download : null,
...this.$attrs,
},
Expand Down

0 comments on commit 4115a85

Please sign in to comment.