fix(仪表板): 修复Tab组件加过滤器轮播视图可能不显示的问题

This commit is contained in:
wangjiahao 2022-11-29 22:18:44 +08:00
parent 39e226c4e4
commit c1fca154db

View File

@ -464,15 +464,20 @@ export default {
} }
}, },
initCarousel() { initCarousel() {
this.timer && clearInterval(this.timer) const _this = this
if (this.element.style.carouselEnable) { _this.timer && clearInterval(_this.timer)
const switchTime = (this.element.style.switchTime || 5) * 1000 if (_this.element.style.carouselEnable) {
const switchTime = (_this.element.style.switchTime || 5) * 1000
let switchCount = 1 let switchCount = 1
// //
this.timer = setInterval(() => { _this.timer = setInterval(() => {
const nowIndex = switchCount % this.element.options.tabList.length const nowIndex = switchCount % _this.element.options.tabList.length
switchCount++ switchCount++
this.activeTabName = this.element.options.tabList[nowIndex].name _this.activeTabName = _this.element.options.tabList[nowIndex].name
const targetRef = _this.$refs['canvasTabRef-' + _this.activeTabName]
if (targetRef) {
targetRef[0].restore()
}
}, switchTime) }, switchTime)
} }
}, },