Reputation: 13
Cheers everyone. I have encountered a problem with following links.
I need to assign link to a button. Can I wrap router-link in a button?
<template lang="html">
<button @click="" v-if="status == 'SUCCESS'"><font-awesome-icon icon="check" /></button>
<button @click="" v-else-if="status == 'CRASH'"><font-awesome-icon icon="times" /></button>
<button @click="" v-else-if="status == 'NO_DATA'"><font-awesome-icon icon="minus" /></button>
<button v-else>What?</button>
</template>
Upvotes: 0
Views: 2507
Reputation: 3608
Just assign the :to=""
value to your button and it'll be turned into a valid vue-router
link.
For example:
<button :to="{name: 'Home'}" />
Would be turned into:
<a href="/index"></a>
Upvotes: 3