feat: add scoped slot for icon in menu.js; :star:
新增:为 menus.js 的 icon 增加 scoped slot API;
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | renderIcon: function (h, icon) { |
| | | renderIcon: function (h, icon, key) { |
| | | if (this.$scopedSlots.icon) { |
| | | return this.$scopedSlots.icon({icon, key}) |
| | | } |
| | | return !icon || icon == 'none' ? null : h(Icon, {props: {type: icon}}) |
| | | }, |
| | | renderMenuItem: function (h, menu) { |
| | |
| | | [ |
| | | h('router-link', {props: {to: menu.fullPath}}, |
| | | [ |
| | | this.renderIcon(h, menu.meta ? menu.meta.icon : 'none'), |
| | | this.renderIcon(h, menu.meta ? menu.meta.icon : 'none', menu.fullPath), |
| | | h('span', [this.$t(getI18nKey(menu.fullPath))]) |
| | | ] |
| | | ) |
| | |
| | | let this_ = this |
| | | let subItem = [h('span', {slot: 'title'}, |
| | | [ |
| | | this.renderIcon(h, menu.meta ? menu.meta.icon : 'none'), |
| | | this.renderIcon(h, menu.meta ? menu.meta.icon : 'none', menu.fullPath), |
| | | h('span', [this.$t(getI18nKey(menu.fullPath))]) |
| | | ] |
| | | )] |