useEffect(() => {
if (selectedKey) {
const menuElement = document.getElementById(`${selectedKey[0]}`);
if (menuElement) {
menuElement.scrollIntoView({
behavior: 'smooth',
block: 'center',
inline: 'nearest',
});
}
}
}, [selectedKey]);
<Menu
ref={menuRef}
mode="inline"
className={classes.menu}
openKeys={activeOpenkeys}
defaultOpenKeys={['@ctrip/xtaro-platform-component']}
onOpenChange={onOpenChange}
style={{ height: '100%', overflowY: 'auto' }}
items={activeComponents}
selectedKeys={selectedKey}
onSelect={onSelect}
/>;