Browse Source

修改判断对象是否存在bug

daxiong.yang 7 years ago
parent
commit
aaf7338893
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/views/layout/sidebar.vue

+ 3 - 3
src/views/layout/sidebar.vue

27
  import API from '@/api'
27
  import API from '@/api'
28
  import { mapMutations } from 'vuex'
28
  import { mapMutations } from 'vuex'
29
  import { getRouteNameByUrl } from '@/utils'
29
  import { getRouteNameByUrl } from '@/utils'
30
  import isEmpty from 'lodash/isEmpty'
30
  import isNil from 'lodash/isNil'
31
  export default {
31
  export default {
32
    data () {
32
    data () {
33
      return {
33
      return {
63
        if (/^\/n\/.*$/.test(route.path)) {
63
        if (/^\/n\/.*$/.test(route.path)) {
64
          var tab = this.$store.state.contentTabs.filter(item => item.name === route.name)[0]
64
          var tab = this.$store.state.contentTabs.filter(item => item.name === route.name)[0]
65
          // tab不存在, 先添加
65
          // tab不存在, 先添加
66
          if (isEmpty(tab)) {
66
          if (isNil(tab)) {
67
            var menuNav = this.getMenuNavByRouteName(route.name, this.$store.state.menuNavList)
67
            var menuNav = this.getMenuNavByRouteName(route.name, this.$store.state.menuNavList)
68
            if (!isEmpty(menuNav)) {
68
            if (!isNil(menuNav)) {
69
              tab = {
69
              tab = {
70
                id: menuNav.menuId,
70
                id: menuNav.menuId,
71
                name: route.name,
71
                name: route.name,