研发图纸文件管理系统-前端项目
feat: add scoped slot for icon in menu.js; :star:
新增:为 menus.js 的 icon 增加 scoped slot API;
1个文件已修改
9 ■■■■■ 已修改文件
src/components/menu/menu.js 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/menu/menu.js
@@ -119,7 +119,10 @@
    }
  },
  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) {
@@ -128,7 +131,7 @@
        [
          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))])
            ]
          )
@@ -139,7 +142,7 @@
      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))])
        ]
      )]