-
-
+
Text
diff --git a/packages/tab/test/index.spec.js b/packages/tab/test/index.spec.js
index c9743bde6..6a84b0198 100644
--- a/packages/tab/test/index.spec.js
+++ b/packages/tab/test/index.spec.js
@@ -93,5 +93,7 @@ test('change tabs data', async () => {
color: 'blue',
title1: 'new title1'
});
+
+ await later();
expect(wrapper).toMatchSnapshot();
});
diff --git a/packages/tabs/index.vue b/packages/tabs/index.vue
index 74cf10348..37b3494df 100644
--- a/packages/tabs/index.vue
+++ b/packages/tabs/index.vue
@@ -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;