Skip to content

Commit

Permalink
fix(tab-bar): fix tab-bar's bug in async scene
Browse files Browse the repository at this point in the history
  • Loading branch information
theniceangel committed Aug 31, 2018
1 parent f5c9359 commit 88a0774
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/tab-bar/tab-bar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
offset = `${offset}px`
}
if (slider) {
if (this.useTransition) slider.style[TRANSITION] = `all 0.2s linear`
if (this.useTransition) slider.style[TRANSITION] = `${TRANSFORM} 0.2s linear`
slider.style[TRANSFORM] = `translateX(${offset}) translateZ(0)`
}
},
Expand Down
5 changes: 5 additions & 0 deletions src/components/tab-panels/tab-panels.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
const TRANSFORM = prefixStyle('transform')
const COMPONENT_NAME = 'cube-tab-panels'
const INDEX_OUT_OF_BOUNDARY = -1
export default {
name: COMPONENT_NAME,
Expand All @@ -43,6 +44,10 @@
methods: {
_move(label) {
const curIndex = findIndex(this.panels, panel => panel.label === label)
/* istanbul ignore if */
if (curIndex === INDEX_OUT_OF_BOUNDARY) {
return
}
const panelsGroup = this.$refs.panelsGroup
const distance = -(curIndex * 100)
panelsGroup.style[TRANSFORM] = `translateX(${distance}%)`
Expand Down

0 comments on commit 88a0774

Please sign in to comment.