Files
mayfly-go/mayfly_go_web/src/layout/navMenu/subItem.vue

46 lines
1.3 KiB
Vue
Raw Normal View History

<template>
<template v-for="val in chils">
<el-sub-menu :index="val.path" :key="val.path" v-if="val.children && val.children.length > 0">
<template #title>
2023-12-13 17:32:17 +08:00
<SvgIcon :name="val.meta.icon" />
<span>{{ val.meta.title }}</span>
</template>
<sub-item :chil="val.children" />
</el-sub-menu>
2023-03-16 16:40:57 +08:00
<el-menu-item :index="val.path" :key="val?.path" v-else>
<template v-if="!val.meta.link || (val.meta.link && val.meta.linkType == 1)">
2023-12-13 17:32:17 +08:00
<SvgIcon :name="val.meta.icon" />
<span>{{ val.meta.title }}</span>
</template>
<template v-else>
<a :href="val.meta.link" target="_blank">
2023-12-13 17:32:17 +08:00
<SvgIcon :name="val.meta.icon" />
{{ val.meta.title }}
</a>
</template>
</el-menu-item>
</template>
</template>
<script lang="ts">
import { computed, defineComponent } from 'vue';
export default defineComponent({
name: 'navMenuSubItem',
props: {
chil: {
type: Array,
default: () => [],
},
},
setup(props) {
// 获取父级菜单数据
const chils = computed(() => {
2023-03-16 16:40:57 +08:00
return props.chil as any;
});
return {
chils,
};
},
});
</script>