tabs: [ '/home', '/about', '/chat' ];
<ResponsiveNav ppearance="subtle" justified
removable
moreText={<Icon icon="more" />}
moreProps={{ noCaret: true }}
activeKey={activePage['link']}
onSelect={onSelectTab}
onItemRemove={eventKey => {
console.log(eventKey)
}}>
{tabs.map(tab => {
const menu = menus.find(a => a.link === tab);
return <ResponsiveNav.Item key={menu ?.key} eventKey={tab}> {menu ?.label}</ResponsiveNav.Item>
})}
</ResponsiveNav>
如何'/chat'
从选项卡中删除值。我试过的是我在onItemRemove
const tabList = [...tabs]
tabList.splice(
tabList.map(item => item).indexOf(eventKey),
1
);
tabs.push(...tabList)
router.push(tabList[0] ? tabList[0] : '/')
但它不起作用。每次我单击它时,都会不断推送一个值。