31 lines
652 B
Vue
31 lines
652 B
Vue
<template>
|
|
<q-btn v-if="isGranted" flat dense :icon="icon" :to="{ name: link }" />
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { computed, defineComponent } from 'vue';
|
|
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,
|
|
type: Array as () => Array<string>,
|
|
},
|
|
},
|
|
setup(props) {
|
|
const isGranted = computed(() => hasPermissions(props.permissions || []));
|
|
return { isGranted };
|
|
},
|
|
});
|
|
</script>
|