mirror of
https://github.com/youzan/vant.git
synced 2025-10-21 19:24:16 +00:00
[bugfix] Tab: should not have line animation when inited (#2459)
This commit is contained in:
@@ -198,12 +198,9 @@ export default create({
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.correctActive(this.active);
|
||||
this.setLine();
|
||||
|
||||
this.$nextTick(() => {
|
||||
this.inited = true;
|
||||
this.handlers(true);
|
||||
this.scrollIntoView(true);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -293,6 +290,8 @@ export default create({
|
||||
|
||||
// update nav bar style
|
||||
setLine() {
|
||||
const shouldAnimate = this.inited;
|
||||
|
||||
this.$nextTick(() => {
|
||||
const { tabs } = this.$refs;
|
||||
|
||||
@@ -308,10 +307,13 @@ export default create({
|
||||
const lineStyle = {
|
||||
width: `${width}px`,
|
||||
backgroundColor: this.color,
|
||||
transform: `translateX(${left}px)`,
|
||||
transitionDuration: `${this.duration}s`
|
||||
transform: `translateX(${left}px)`
|
||||
};
|
||||
|
||||
if (shouldAnimate) {
|
||||
lineStyle.transitionDuration = `${this.duration}s`;
|
||||
}
|
||||
|
||||
if (this.isDef(lineHeight)) {
|
||||
const height = `${lineHeight}px`;
|
||||
lineStyle.height = height;
|
||||
|
Reference in New Issue
Block a user