27 lines
802 B
Vue
27 lines
802 B
Vue
|
<script lang="jsx">
|
||
|
import { h } from 'vue'
|
||
|
import {ElMenuItem,ElSubMenu} from 'element-plus'
|
||
|
import { resolveComponent } from 'vue'
|
||
|
export default {
|
||
|
props: {
|
||
|
menuConfig:Object
|
||
|
},
|
||
|
setup(props,{ slots } ) {
|
||
|
// 返回渲染函数
|
||
|
return () => !props.menuConfig.isGroup?h(ElMenuItem,{index:props.menuConfig.title},()=> props.menuConfig.title):
|
||
|
// (<el-sub-menu><template #title>
|
||
|
// <el-icon><location/></el-icon>
|
||
|
// <span>Navigator One</span>
|
||
|
// </template></el-sub-menu>)
|
||
|
h(ElSubMenu,{index:props.menuConfig.title},()=>[
|
||
|
...props.menuConfig.childrens.map(subMenu=>{
|
||
|
return h(ElMenuItem,{index:subMenu.label},()=>subMenu.label)
|
||
|
})])
|
||
|
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style>
|
||
|
|
||
|
</style>
|