1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Vue3动态引入Element-plus icon图标

Vue3动态引入Element-plus icon图标

时间:2020-01-08 20:16:06

相关推荐

Vue3动态引入Element-plus icon图标

直接贴代码

list数据:

const list = reactive([{path: "/user",name: "user",label: "用户管理",icon: "user",url: "UserManage/UserManage"},{label: "其他",icon: "location",path: "/other",children: [{path: "/page1",name: "page1",label: "页面1",icon: "setting",url: "Other/PageOne"},{path: "/page2",name: "page2",label: "页面2",icon: "setting",url: "Other/PageTwo"}]}])

动态引入icon图标: el-icon包裹(不包裹的话图标会很大,需要设置样式),用动态组件的方式引入图标

<el-menu-item :index="item.path" v-for="item in noChildren" :key="item.path"><el-icon><component class="icons" :is="item.icon"></component></el-icon><span>{{ item.label }}</span></el-menu-item>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。