From ef1e74786906d66c2ab33b63ca2acf0ae089c4d1 Mon Sep 17 00:00:00 2001 From: rex Date: Tue, 26 Nov 2019 21:33:21 +0800 Subject: [PATCH] fix(Tab): fix prop active not work in init (#2395) fix #2390 --- example/pages/tab/index.wxml | 2 +- packages/tabs/index.ts | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/example/pages/tab/index.wxml b/example/pages/tab/index.wxml index 0fe6f836..81d33a4e 100644 --- a/example/pages/tab/index.wxml +++ b/example/pages/tab/index.wxml @@ -13,7 +13,7 @@ - + child.getComputedName() === name ); - const defaultIndex = (children[0] || {}).index || 0; - this.setCurrentIndex(matched.length ? matched[0].index : defaultIndex); + + if (matched.length) { + this.setCurrentIndex(matched[0].index); + } }, setCurrentIndex(currentIndex) {