How to use the goToTab property in antd-mobile Tabs component Tabs.DefaultTabBar

1. How to use the goToTab attribute in antd-mobile Tabs component Tabs.DefaultTabBar?
2,
clipboard.png
3
clipboard.png

Mar.09,2022

not currently using gotoTab, to take a look at the source code, gotoTab only works for the default tabBar (that pile of headings), and only provides additional operations at gotoTab. The specific gotoTab is called during onPress, so it is only used for additional operations when the user clicks on defaultTabBar.

clipboard.png

if you just want to manually switch to a tab, that currently uses the page attribute in Tabs, specify which page to jump to. Note that the attribute value should be of type state, which triggers re-rendering.

Menu