[antd: Menu] `children` will be removed in next major version. Please use `items` instead.
devScripts.js:6523 Warning: [antd: Menu]will be removed in next major version. Please useinstead.原因:https://ant.design/components/menu/修改antd menu组件的使用方式
·
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} />
更多推荐
已为社区贡献10条内容
所有评论(0)