problem description
antdmenuSubMenu
SubMenu
Menu.ItemSubMenu
Menu{}js
SubPopupMenu.js:359 Uncaught TypeError: Cannot read property "mode" of undefined
index.js:1446 The above error occurred in the <SubPopupMenu> component:
react-dom.development.js:20781 Uncaught TypeError: Cannot read property "mode" of undefined
the environmental background of the problems and what methods you have tried
the project is created using react scaffolding-typescript, and is trying to use the development of ts+react
"dependencies": {
"@types/jest": "24.0.0",
"@types/node": "10.12.24",
"@types/react": "16.8.2",
"@types/react-dom": "16.8.0",
"antd": "^3.13.2",
"axios": "^0.18.0",
"babel-plugin-import": "^1.11.0",
"node-sass": "^4.11.0",
"react": "^16.8.1",
"react-dom": "^16.8.1",
"react-router-dom": "^4.3.1",
"react-scripts": "2.1.4",
"typescript": "3.3.3"
}
related codes
/ / Please paste the code text below (do not replace the code with pictures)
render() {
let MenuConfig= [
{
title: "",
key: "/admin/home"
},
{
title: "2",
key: "/admin/home2"
},
{
title: "3",
key: "/admin/home3",
children: [
{
title: "",
key: "/admin/home4"
}
]
}
]
return (
<div>
<Menu mode="vertical" theme="dark" >
{MenuConfig.map(item =>
item.children ?
<SubMenu title={item.title} key={item.key}> {this.renderMenu(item.children)}</SubMenu>
:
<Menu.Item title={item.title} key={item.key}>{item.title}</Menu.Item>
)}
</Menu>
</div>
)
}
ask for answers from all kinds of gods ~