如果根据 localStorage 设置满足条件,我似乎无法让选项卡呈现为活动状态。这是我所拥有的:
<TabList id="my-view-menu" direction="row" spacing={4}>
<Tab
colorScheme="#000"
fontSize="sm"
variant="link"
onClick={(e) => handleDefaultView(e)}
isSelected={localStorage.getItem('view') === 'default' ? true : false}
>
Default
</Tab>
<Tab
colorScheme="#000"
fontSize="sm"
variant="link"
onClick={(e) => handleMyView(e)}
isSelected={localStorage.getItem('view') === 'myView' ? true : false}
>
My View
</Tab>
</TabList>;