navInject.js 690 字节
Newer Older
D
DCloud_LXH 已提交
1
export default {
D
DCloud_LXH 已提交
2
  inject: ['navConfig', 'customNavBar', 'changeUserNav', 'customNavBarKeys'],
D
DCloud_LXH 已提交
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

  computed: {
    showSubNavBar() {
      return !!this.customNavBar[this.navConfig.userNavIndex].items
    },
    mainNavBarText() {
      return this.customNavBar[this.navConfig.userNavIndex].text
    },
    subNavBarText() {
      const curNavBar = this.customNavBar[this.navConfig.userNavIndex]
      const curLink = (this.$page.path.match(/\/(\w+)+\/*/) || [])[1]
      const item = curNavBar.items ? curNavBar.items.filter(
        item => item.type === 'link' && item.link.indexOf(curLink) !== -1
      )[0] : curNavBar
      return item ? item.text : curNavBar.items[0].text
    }
  }
}