0
0
Fork 0
salix-front-mindshore-fork2/src/components/LeftMenuItem.vue

36 lines
1014 B
Vue

<script setup>
import { computed } from 'vue';
import { useI18n } from 'vue-i18n';
const { t, te } = useI18n();
const props = defineProps({
item: {
type: Object,
required: true,
},
});
const itemComputed = computed(() => {
const item = JSON.parse(JSON.stringify(props.item));
const [, , section] = item.title.split('.');
if (!te(item.title)) item.title = t(`globals.pageTitles.${section}`);
return item;
});
</script>
<template>
<QItem active-class="bg-hover" :to="{ name: itemComputed.name }" clickable v-ripple>
<QItemSection avatar v-if="itemComputed.icon">
<QIcon :name="itemComputed.icon" />
</QItemSection>
<QItemSection avatar v-if="!itemComputed.icon">
<QIcon name="disabled_by_default" />
</QItemSection>
<QItemSection>{{ t(itemComputed.title) }}</QItemSection>
<QItemSection side>
<slot name="side" :item="itemComputed" />
</QItemSection>
</QItem>
</template>