Commit 8b41022044707b33f22aeec4d9dbd04db4f381f6

Authored by Aresn
Committed by GitHub
1 parent 38ab7442

handleTabKeyboardSelect add params init

So, when mounted, the event not emit.
Showing 1 changed file with 3 additions and 2 deletions   Show diff stats
src/components/tabs/tabs.vue
@@ -236,7 +236,8 @@ @@ -236,7 +236,8 @@
236 const nextTab = getNextTab(this.navList, this.focusedKey, direction); 236 const nextTab = getNextTab(this.navList, this.focusedKey, direction);
237 this.focusedKey = nextTab.name; 237 this.focusedKey = nextTab.name;
238 }, 238 },
239 - handleTabKeyboardSelect(){ 239 + handleTabKeyboardSelect(init = false){
  240 + if (init) return;
240 const focused = this.focusedKey || 0; 241 const focused = this.focusedKey || 0;
241 const index = this.navList.findIndex(({name}) => name === focused); 242 const index = this.navList.findIndex(({name}) => name === focused);
242 this.handleChange(index); 243 this.handleChange(index);
@@ -416,7 +417,7 @@ @@ -416,7 +417,7 @@
416 this.mutationObserver.observe(hiddenParentNode, { attributes: true, childList: true, characterData: true, attributeFilter: ['style'] }); 417 this.mutationObserver.observe(hiddenParentNode, { attributes: true, childList: true, characterData: true, attributeFilter: ['style'] });
417 } 418 }
418 419
419 - this.handleTabKeyboardSelect(); 420 + this.handleTabKeyboardSelect(true);
420 }, 421 },
421 beforeDestroy() { 422 beforeDestroy() {
422 this.observer.removeListener(this.$refs.navWrap, this.handleResize); 423 this.observer.removeListener(this.$refs.navWrap, this.handleResize);