소스 검색

Menu: fix indexPath of undefined

qingwei.li 8 년 전
부모
커밋
eb02763837
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      packages/menu/src/menu.vue

+ 2 - 0
packages/menu/src/menu.vue

@@ -46,6 +46,7 @@
     watch: {
       defaultActive(value) {
         this.activeIndex = value;
+        if (!this.menuItems[value]) return;
         let indexPath = this.menuItems[value].indexPath;
 
         this.handleSelect(value, indexPath);
@@ -97,6 +98,7 @@
       },
       openActiveItemMenus() {
         let index = this.activeIndex;
+        if (!this.menuItems[index]) return;
         if (index && this.mode === 'vertical') {
           let indexPath = this.menuItems[index].indexPath;