diff --git a/examples/routers/tabs.vue b/examples/routers/tabs.vue index cb017f6..0f7a972 100644 --- a/examples/routers/tabs.vue +++ b/examples/routers/tabs.vue @@ -1,180 +1,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -182,15 +14,13 @@ export default { data () { return { - tabs: 2 - } + name: 'b' + }; }, methods: { - handleTabsAdd () { - this.tabs ++; + handleClick (name) { + console.log(name); } } - } + }; - - diff --git a/src/components/tabs/tabs.vue b/src/components/tabs/tabs.vue index 243fea2..c4cb959 100644 --- a/src/components/tabs/tabs.vue +++ b/src/components/tabs/tabs.vue @@ -47,19 +47,6 @@ else return nextTab; }; - const focusFirst = (element, root) => { - try {element.focus();} - catch(err) {} // eslint-disable-line no-empty - - if (document.activeElement == element && element !== root) return true; - - const candidates = element.children; - for (let candidate of candidates) { - if (focusFirst(candidate, root)) return true; - } - return false; - }; - export default { name: 'Tabs', mixins: [ Emitter ], @@ -240,18 +227,7 @@ this.activeKey = this.focusedKey || 0; const nextIndex = Math.max(this.navList.findIndex(tab => tab.name === this.focusedKey), 0); - [...this.$refs.panes.children].forEach((el, i) => { - if (nextIndex === i) { - [...el.children].forEach(child => child.style.display = 'block'); - setTimeout(() => { - focusFirst(el, el); - }, transitionTime); - } else { - setTimeout(() => { - [...el.children].forEach(child => child.style.display = 'none'); - }, transitionTime); - } - }); + this.handleChange(nextIndex); }, handleRemove (index) { const tabs = this.getTabs(); @@ -412,8 +388,6 @@ this.mutationObserver.observe(hiddenParentNode, { attributes: true, childList: true, characterData: true, attributeFilter: ['style'] }); } - - this.handleTabKeyboardSelect(); }, beforeDestroy() { this.observer.removeListener(this.$refs.navWrap, this.handleResize); -- libgit2 0.21.4