devScripts.js:6523 Warning: [antd: Menu] children will be removed in next major version. Please use items instead.

problem

原因:https://ant.design/components/menu/

reason

修改antd menu组件的使用方式

solution

// before 
<Menu className={styles.menu} selectedKeys={[]} onClick={onMenuClick}>
    {menu && (<Menu.Item key="center"><UserOutlined />个人中心</Menu.Item>)}
    {menu && (<Menu.Item key="settings"><SettingOutlined />个人设置</Menu.Item>)}
    {menu && <Menu.Divider />}
    <Menu.Item key="logout"><LogoutOutlined />退出登录</Menu.Item>
</Menu>

// after 
const centerMenu = {label: '个人中心', icon: <UserOutlined />, key: 'center'};
const settingsMenu = {label: '个人设置', icon: <SettingOutlined />, key: 'settings'};
// const dividerItem = {type: 'divider'}; // 还不确定如何添加 
const logoutMenu = {label: '退出登录', icon: <LogoutOutlined />, key: 'logout'};
const items = [centerMenu,settingsMenu, logoutMenu];
const menuHeaderDropdown = <Menu className={styles.menu} selectedKeys={[]} onClick={onMenuClick} items={items} /> 
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐