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';
|
2020-11-24 17:42:43 +00:00
|
|
|
import { hasPermissions } from 'src/utils/permission';
|
2021-03-22 02:24:27 +00:00
|
|
|
import { FG_Plugin } from 'src/plugins';
|
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(() =>
|
|
|
|
typeof props.entry.title === 'object' ? props.entry.title.value : props.entry.title
|
|
|
|
);
|
|
|
|
return { isGranted, title };
|
2021-03-18 16:23:57 +00:00
|
|
|
},
|
2020-10-02 07:13:14 +00:00
|
|
|
});
|
|
|
|
</script>
|