[bugfix] Tab: should not have line animation when inited (#2459)

This commit is contained in:
neverland
2019-01-07 19:22:40 +08:00
committed by GitHub
parent 2c3458587e
commit dd20a170ab
3 changed files with 15 additions and 11 deletions

View File

@@ -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;