Skip to content

Commit 88a0774

Browse files
committed
fix(tab-bar): fix tab-bar's bug in async scene
1 parent f5c9359 commit 88a0774

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/components/tab-bar/tab-bar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
offset = `${offset}px`
9696
}
9797
if (slider) {
98-
if (this.useTransition) slider.style[TRANSITION] = `all 0.2s linear`
98+
if (this.useTransition) slider.style[TRANSITION] = `${TRANSFORM} 0.2s linear`
9999
slider.style[TRANSFORM] = `translateX(${offset}) translateZ(0)`
100100
}
101101
},

src/components/tab-panels/tab-panels.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
const TRANSFORM = prefixStyle('transform')
2121
2222
const COMPONENT_NAME = 'cube-tab-panels'
23+
const INDEX_OUT_OF_BOUNDARY = -1
2324
2425
export default {
2526
name: COMPONENT_NAME,
@@ -43,6 +44,10 @@
4344
methods: {
4445
_move(label) {
4546
const curIndex = findIndex(this.panels, panel => panel.label === label)
47+
/* istanbul ignore if */
48+
if (curIndex === INDEX_OUT_OF_BOUNDARY) {
49+
return
50+
}
4651
const panelsGroup = this.$refs.panelsGroup
4752
const distance = -(curIndex * 100)
4853
panelsGroup.style[TRANSFORM] = `translateX(${distance}%)`

0 commit comments

Comments
 (0)