提交 88a0774b 编写于 作者: T theniceangel

fix(tab-bar): fix tab-bar's bug in async scene

上级 f5c93598
......@@ -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)`
}
},
......
......@@ -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,
......@@ -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}%)`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册