35 lines
963 B
Vue
35 lines
963 B
Vue
<template>
|
|
<AMenuItem
|
|
:disabled="props.item.meta?.disabled ?? false"
|
|
:key="props.item.name"
|
|
@click="handleClickMenuItem(item)"
|
|
>
|
|
<template #icon>
|
|
<BaseIcon :size="menuIconSize" v-if="props.item.meta?.icon" :icon="props.item.meta?.icon" />
|
|
</template>
|
|
<span>{{ props.item.meta.title ?? props.item.name }}</span>
|
|
<!-- <template #title>1111</template>-->
|
|
<!-- <div class="flex"></div>-->
|
|
</AMenuItem>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { menuIconSize } from '@root/config'
|
|
import type { RouteRecordRaw } from 'vue-router'
|
|
import { confirmMenuAccess } from '@/utils/adminPageAccess'
|
|
|
|
const router = useRouter()
|
|
interface Props {
|
|
item: RouteRecordRaw
|
|
}
|
|
|
|
const props = withDefaults(defineProps<Props>(), {})
|
|
|
|
async function handleClickMenuItem(item: RouteRecordRaw) {
|
|
if (!confirmMenuAccess(item.name)) return
|
|
router.push({ name: item.name })
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less"></style>
|