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

51 lines
1.0 KiB
Vue
Raw Normal View History

2020-10-02 07:13:14 +00:00
<template>
<q-item v-if="isGranted" clickable tag="a" target="self" :to="{ name: link }">
<q-item-section v-if="icon" avatar>
<q-icon :name="icon" />
2020-10-02 07:13:14 +00:00
</q-item-section>
<q-item-section>
<q-item-label>{{ title }}</q-item-label>
<!--<q-item-label caption>
{{ caption }}
</q-item-label>-->
2020-10-02 07:13:14 +00:00
</q-item-section>
</q-item>
</template>
<script lang="ts">
import { computed, defineComponent } from 'vue';
import { hasPermissions } from 'src/utils/permission';
2020-10-02 07:13:14 +00:00
export default defineComponent({
name: 'EssentialLink',
props: {
title: {
type: String,
required: true,
2020-10-02 07:13:14 +00:00
},
caption: {
type: String,
default: '',
2020-10-02 07:13:14 +00:00
},
link: {
type: String,
default: 'dashboard',
2020-10-02 07:13:14 +00:00
},
icon: {
type: String,
default: '',
2020-10-31 18:33:05 +00:00
},
permissions: {
default: () => Array<string>(),
type: Array as () => Array<string>,
},
2020-10-09 16:04:32 +00:00
},
setup(props) {
const isGranted = computed(() => hasPermissions(props.permissions));
return { isGranted };
},
2020-10-02 07:13:14 +00:00
});
</script>