24 lines
		
	
	
		
			611 B
		
	
	
	
		
			Vue
		
	
	
	
		
		
			
		
	
	
			24 lines
		
	
	
		
			611 B
		
	
	
	
		
			Vue
		
	
	
	
|  | <template> | ||
|  |   <q-btn v-if="isGranted" flat dense :icon="shortcut.icon" :to="{ name: shortcut.link }" /> | ||
|  | </template> | ||
|  | 
 | ||
|  | <script lang="ts"> | ||
|  | import { computed, defineComponent, PropType } from 'vue'; | ||
|  | import { hasPermissions } from 'src/utils/permission'; | ||
|  | import { FG_Plugin } from 'src/plugins'; | ||
|  | 
 | ||
|  | export default defineComponent({ | ||
|  |   name: 'ShortcutLink', | ||
|  |   props: { | ||
|  |     shortcut: { | ||
|  |       required: true, | ||
|  |       type: Object as PropType<FG_Plugin.Shortcut>, | ||
|  |     }, | ||
|  |   }, | ||
|  |   setup(props) { | ||
|  |     const isGranted = computed(() => hasPermissions(props.shortcut.permissions || [])); | ||
|  |     return { isGranted }; | ||
|  |   }, | ||
|  | }); | ||
|  | </script> |