30 lines
610 B
Vue
30 lines
610 B
Vue
<template>
|
|
<q-btn flat dense :icon="icon" :to="{ name: link }" v-if="isGranted" />
|
|
</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,
|
|
},
|
|
},
|
|
setup(props) {
|
|
const isGranted = computed(() => hasPermissions(props.permissions || []));
|
|
return { isGranted };
|
|
},
|
|
});
|
|
</script>
|