diff --git a/packages/tab/index.ts b/packages/tab/index.ts
index 9e6bf76e..68d42702 100644
--- a/packages/tab/index.ts
+++ b/packages/tab/index.ts
@@ -50,8 +50,7 @@ VantComponent({
this.inited = this.inited || active;
this.setData({
active,
- shouldRender: this.inited || !parentData.lazyRender,
- shouldShow: active || parentData.animated
+ shouldRender: this.inited || !parentData.lazyRender
});
},
diff --git a/packages/tab/index.wxml b/packages/tab/index.wxml
index d67f2ae4..0fda4a84 100644
--- a/packages/tab/index.wxml
+++ b/packages/tab/index.wxml
@@ -3,7 +3,6 @@
diff --git a/packages/tabs/index.less b/packages/tabs/index.less
index 7d292ca9..1a8fddd9 100644
--- a/packages/tabs/index.less
+++ b/packages/tabs/index.less
@@ -117,6 +117,10 @@
.theme(color, '@tab-disabled-text-color');
}
+ &--complete {
+ flex: 1 0 auto !important;
+ }
+
&__title {
&__info {
position: relative !important;
diff --git a/packages/tabs/index.ts b/packages/tabs/index.ts
index ad9e9c91..c45678e6 100644
--- a/packages/tabs/index.ts
+++ b/packages/tabs/index.ts
@@ -50,6 +50,8 @@ VantComponent({
value: -1,
observer: 'setLine'
},
+ titleActiveColor: String,
+ titleInactiveColor: String,
active: {
type: [String, Number],
value: 0,
@@ -84,7 +86,7 @@ VantComponent({
value: 4,
observer(value) {
this.setData({
- scrollable: this.children.length > value
+ scrollable: this.children.length > value || !this.data.ellipsis
});
}
},
@@ -126,7 +128,7 @@ VantComponent({
const { children = [], data } = this;
this.setData({
tabs: children.map((child: TrivialInstance) => child.data),
- scrollable: children.length > data.swipeThreshold
+ scrollable: this.children.length > data.swipeThreshold || !data.ellipsis
});
this.setCurrentIndexByName(this.getCurrentName() || data.active);
@@ -173,7 +175,6 @@ VantComponent({
if (
!isDef(currentIndex) ||
- currentIndex === data.currentIndex ||
currentIndex >= children.length ||
currentIndex < 0
) {
@@ -185,7 +186,7 @@ VantComponent({
children.forEach((item: TrivialInstance, index: number) => {
const active = index === currentIndex;
- if (active !== item.data.active) {
+ if (active !== item.data.active || !item.inited) {
item.updateRender(active, this);
}
});
@@ -224,8 +225,11 @@ VantComponent({
} = this.data;
this.getRect('.van-tab', true).then(
- (rects: WechatMiniprogram.BoundingClientRectCallbackResult[]) => {
+ (rects: WechatMiniprogram.BoundingClientRectCallbackResult[] = []) => {
const rect = rects[currentIndex];
+ if (rect == null) {
+ return;
+ }
const width = lineWidth !== -1 ? lineWidth : rect.width / 2;
const height =
lineHeight !== -1
diff --git a/packages/tabs/index.wxml b/packages/tabs/index.wxml
index 632601f8..27d44c81 100644
--- a/packages/tabs/index.wxml
+++ b/packages/tabs/index.wxml
@@ -1,4 +1,5 @@
+
-
+
{{ item.title }}