Your button is wrapped in a router-link
this is essentially an anchor
tag... If your button is disabled - it is still wrapped in a router-link
Isn't the anchor (router-link)
still going to be the target of your click?
Also best to use :disabled
as an attribute instead of manipulating/querying the DOM.
<button :disabled="shouldBeDisabled"></button>
Maybe look further into vue-router
you may be able to disable the router-link
attribute similar to the button. (granted disabled button is proabable being styled...) so do both...
I know that there is an attribute you can pass to a router-link
called exact which evaluates to true if the route is consistent with the route the router-link
'links to.
You could check for the exact property maybe? this could eliminate the need for the currentPage
check
You could pass a class of .button
to your router-link
and style it up like a button... this would eliminate the need for the use of a button
that is behaving like an anchor
.