From 7b94ac91996d8803062f8123cf959d4862f2b877 Mon Sep 17 00:00:00 2001 From: gogHeroDream <31148295+gogHeroDream@users.noreply.github.com> Date: Fri, 5 Feb 2021 10:31:13 +0800 Subject: [PATCH] fix(Tabs): incorrect active tab when active prop is zero (#8074) Co-authored-by: songpeng01 --- src/tabs/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tabs/index.js b/src/tabs/index.js index a78c700f4..5fc7a6b29 100644 --- a/src/tabs/index.js +++ b/src/tabs/index.js @@ -372,7 +372,7 @@ export default createComponent({ () => children.length, () => { if (state.inited) { - setCurrentIndexByName(props.active || currentName.value); + setCurrentIndexByName((props.active || props.active === 0) ? props.active : currentName.value); setLine(); nextTick(() => { scrollIntoView(true); @@ -397,7 +397,7 @@ export default createComponent({ ); const init = () => { - setCurrentIndexByName(props.active || currentName.value); + setCurrentIndexByName((props.active || props.active === 0) ? props.active : currentName.value); nextTick(() => { state.inited = true; tabHeight = getVisibleHeight(wrapRef.value);