mirror of https://github.com/ElemeFE/element
Tabs: get the correct tab through tab name (#13705)
parent
f7241f62ef
commit
16311d1e32
|
@ -2,6 +2,7 @@
|
||||||
<div class="el-tabs__active-bar" :class="`is-${ rootTabs.tabPosition }`" :style="barStyle"></div>
|
<div class="el-tabs__active-bar" :class="`is-${ rootTabs.tabPosition }`" :style="barStyle"></div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import { arrayFind } from 'element-ui/src/utils/util';
|
||||||
export default {
|
export default {
|
||||||
name: 'TabBar',
|
name: 'TabBar',
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@
|
||||||
return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
|
return str.toLowerCase().replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
|
||||||
};
|
};
|
||||||
this.tabs.every((tab, index) => {
|
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 (!$el) { return false; }
|
||||||
|
|
||||||
if (!tab.active) {
|
if (!tab.active) {
|
||||||
|
|
Loading…
Reference in New Issue