VUE---路由菜单Icon自定义的实现
16lz
2021-03-12
main.js文件里添加
import { Icon } from 'ant-design-vue'const IconFont = Icon.createFromIconfontCN({ scriptUrl: '/font_icons.js',});Vue.component('IconFont', IconFont)
2.路径:node_modules->@ant-design-vue->es->components->RouteMenu->BaseMenu.js
//添加:const IconFont = Icon.createFromIconfontCN({ //引入 scriptUrl: '/font_icons.js'});//修改:// var props = {};// typeof icon === 'object' ? props.component = icon : props.type = icon;// return h(Icon, { props: props });//改成:var props = {}; if (typeof icon === 'object') { //if else代码是修改 props.component = icon.component props.type = icon.type return h(IconFont, { props: props }); } else { props.type = icon; return h(Icon, { props: props }); }
3.路由中的配置:
icon: { component: 'IconFont', type: icon },
更多相关文章
- Kubernetes日志系统新贵Loki-Stack
- Netscaler添加首页下载连接
- ubuntu14.04开启root用户
- Linux运维教程-Linux系统网络管理
- weh shell高大上?一文教你实现
- Xmind8 激活
- Power BI基础知识——添加列
- 3.14 为vCenter Server服务器添加外部DSN连接
- kubernets中部署高可用nacos