flaschengeist-frontend/src/components/navigation/ShortCutLink.vue

32 lines
656 B
Vue

<template>
<q-btn flat dense :icon="icon" :to="{ name: link }" v-if="isGranted" />
</template>
<script lang="ts">
import { computed, defineComponent } from '@vue/composition-api';
import { hasPermissions } from 'src/utils/permission';
export default defineComponent({
name: 'ShortCutLink',
props: {
link: {
required: true,
type: String
},
icon: {
required: true,
type: String
},
permissions: {
default: undefined
}
},
setup(props, { root }) {
const isGranted = computed(() =>
hasPermissions(props.permissions || [], root.$store)
);
return { isGranted };
}
});
</script>