赞
踩
npm install @element-plus/icons-vue
//如果你已经全局安装element-plus的话就不需要安装这个了,直接按照下面的步骤走就行了
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
// 菜单图标
const icons = reactive([
'User',
'SwitchFilled',
'Document',
'MessageBox',
'Location',
'Shop',
'Orange',
'Suitcase',
'VideoPlay'
])
<el-sub-menu index="1" v-for="(item, index) in menuList" :keys="item.id"> <template #title> <el-icon> <component :is="icons[index]"></component> </el-icon> <span>{{ item.authName }}</span> </template> <el-menu-item :index="itemChild.id" v-for="(itemChild, indexChild) in item.children" :keys="itemChild.id"> <el-icon> <Location /> </el-icon> <span> {{ itemChild.authName }}</span> </el-menu-item> </el-sub-menu>
<el-icon>
<component :is="icons[index]"></component>
</el-icon>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。