2020-10-02 07:13:14 +00:00
|
|
|
<template>
|
2021-03-22 02:24:27 +00:00
|
|
|
<q-item v-if="isGranted" clickable tag="a" target="self" :to="{ name: entry.link }">
|
|
|
|
<q-item-section v-if="entry.icon" avatar>
|
|
|
|
<q-icon :name="entry.icon" />
|
2020-10-02 07:13:14 +00:00
|
|
|
</q-item-section>
|
|
|
|
|
|
|
|
<q-item-section>
|
2021-02-02 21:32:23 +00:00
|
|
|
<q-item-label>{{ title }}</q-item-label>
|
2020-10-02 07:13:14 +00:00
|
|
|
</q-item-section>
|
|
|
|
</q-item>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
2021-03-22 02:24:27 +00:00
|
|
|
import { computed, defineComponent, PropType } from 'vue';
|
2021-05-25 14:13:15 +00:00
|
|
|
import { hasPermissions } from '@flaschengeist/api';
|
|
|
|
import { FG_Plugin } from '@flaschengeist/types';
|
2020-10-02 07:13:14 +00:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
name: 'EssentialLink',
|
|
|
|
props: {
|
2021-03-22 02:24:27 +00:00
|
|
|
entry: {
|
|
|
|
type: Object as PropType<FG_Plugin.MenuLink>,
|
2021-03-18 16:23:57 +00:00
|
|
|
required: true,
|
2020-10-02 07:13:14 +00:00
|
|
|
},
|
2020-10-09 16:04:32 +00:00
|
|
|
},
|
2020-10-17 10:56:25 +00:00
|
|
|
|
2021-01-30 05:19:43 +00:00
|
|
|
setup(props) {
|
2021-03-22 02:24:27 +00:00
|
|
|
const isGranted = computed(() => hasPermissions(props.entry.permissions || []));
|
|
|
|
const title = computed(() =>
|
2021-05-20 18:31:37 +00:00
|
|
|
typeof props.entry.title === 'function' ? props.entry.title() : props.entry.title
|
2021-03-22 02:24:27 +00:00
|
|
|
);
|
|
|
|
return { isGranted, title };
|
2021-03-18 16:23:57 +00:00
|
|
|
},
|
2020-10-02 07:13:14 +00:00
|
|
|
});
|
|
|
|
</script>
|