fixed 配置下划线不显示的问题

This commit is contained in:
marvzhang
2019-11-28 12:54:56 +08:00
parent 0bbcd1b64f
commit b9c7920b76
2 changed files with 16 additions and 2 deletions

View File

@@ -538,6 +538,16 @@ export default {
},
onTabClick (tab) {
this.activeTab = tab.name
},
update () {
if (this.activeTab !== 'stages') return
// 手动显示tab下划线
const elBar = document.querySelector('.el-tabs__active-bar')
const elStages = document.querySelector('#tab-stages')
const totalWidth = Number(getComputedStyle(elStages).width.replace('px', ''))
const paddingRight = Number(getComputedStyle(elStages).paddingRight.replace('px', ''))
elBar.setAttribute('style', 'width:' + (totalWidth - paddingRight) + 'px')
}
},
created () {

View File

@@ -13,8 +13,8 @@
<el-tab-pane :label="$t('Overview')" name="overview">
<spider-overview/>
</el-tab-pane>
<el-tab-pane v-if="isConfigurable" :label="$t('Config')" name="配置">
<config-list/>
<el-tab-pane v-if="isConfigurable" :label="$t('Config')" name="config">
<config-list ref="config"/>
</el-tab-pane>
<el-tab-pane :label="$t('Files')" name="files">
<file-list/>
@@ -77,6 +77,10 @@ export default {
setTimeout(() => {
this.$refs['spider-stats'].update()
}, 0)
} else if (this.activeTabName === 'config') {
setTimeout(() => {
this.$refs['config'].update()
}, 0)
}
this.$st.sendEv('爬虫详情', '切换标签', tab.name)
},