fix: problem that title of menu item can't be hidden when using slot icon in side menu; 🐛

修复:在侧边栏菜单中使用插槽图标时,菜单项标题不能隐藏的问题;
master
iczer 4 years ago
parent 3b3cd76e51
commit 902afbe47a
  1. 7
      src/components/menu/menu.js

@ -121,7 +121,12 @@ export default {
methods: {
renderIcon: function (h, icon, key) {
if (this.$scopedSlots.icon && icon && icon !== 'none') {
return this.$scopedSlots.icon({icon, key})
const vnodes = this.$scopedSlots.icon({icon, key})
vnodes.forEach(vnode => {
vnode.data.class = vnode.data.class ? vnode.data.class : []
vnode.data.class.push('anticon')
})
return vnodes
}
return !icon || icon == 'none' ? null : h(Icon, {props: {type: icon}})
},

Loading…
Cancel
Save