Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Widgets/BtnRouter.vue
- This file was added.
<template> | |||||
<router-link :to="to" custom v-slot="{ navigate }"> | |||||
<btn :class="className()" :icon="icon" @click="navigate"> | |||||
<slot></slot> | |||||
</btn> | |||||
</router-link> | |||||
</template> | |||||
<script> | |||||
export default { | |||||
props: { | |||||
to: { type: [ Object, String ], default: () => {} }, | |||||
icon: { type: [ Array, String ], default: '' }, | |||||
}, | |||||
methods: { | |||||
className() { | |||||
let label = this.to.length ? this.to : this.to.name | |||||
return ['btn', label.replace('/', '-')] | |||||
} | |||||
} | |||||
} | |||||
</script> |