Tabs: get the correct tab through tab name (#13705)

pull/13714/head
iamkun 2018-12-10 16:46:55 +08:00 committed by hetech
parent f7241f62ef
commit 16311d1e32
1 changed files with 2 additions and 1 deletions

View File

@ -2,6 +2,7 @@
<div class="el-tabs__active-bar" :class="`is-${ rootTabs.tabPosition }`" :style="barStyle"></div>
</template>
<script>
import { arrayFind } from 'element-ui/src/utils/util';
export default {
name: 'TabBar',
@ -25,7 +26,7 @@
return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
};
this.tabs.every((tab, index) => {
let $el = this.$parent.$refs.tabs[index];
let $el = arrayFind(this.$parent.$refs.tabs, t => t.id.replace('tab-', '') === tab.name);
if (!$el) { return false; }
if (!tab.active) {