We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
在app.tsx中layout对象里使用request获取到数据并渲染的菜单总是会默认选中菜单的最后一项,并触发两次onSelect事件。并且后续的onClick和onSelect事件都失效了。也无法再选中其他项菜单。
//从服务器获取菜单数据 menu: { // 每当 initialState?.currentUser?.userid 发生修改时重新执行 request params: { // userId: initialState }, // eslint-disable-next-line @typescript-eslint/no-unused-vars request: async (params: void, defaultMenuData: any) => { const menus = await getMenuList().then((res: any) => { return res.data.map((item: any) => { subMenuArr.push(item.id) return { path: '/', name: item.meta.title, icon: React.createElement(allIcons['SettingOutlined']), key: item.name + item.meta.title, routes: item.children.map((element: any) => { return { // path: '/?path=' + element.fullUrl, // path: 'https://procomponents.ant.design/components/layout', path: '/', name: element.meta.title, key: element.name + element.meta.title, }; }), }; }); }); // initialState.currentUser 中包含了所有用户信息 setInitialState({ ...initialState, rootSubmenuKeys: subMenuArr }) return menus; }, onClick: ({ item }: { item: any }) => { console.log(item, 'item,选中菜单'); }, },
The text was updated successfully, but these errors were encountered:
当前 Issue 未检测到标题,请规范填写,谢谢!
The title of the current issue is not detected, please fill in according to the specifications, thank you!
Sorry, something went wrong.
No branches or pull requests
🐛 bug 描述
在app.tsx中layout对象里使用request获取到数据并渲染的菜单总是会默认选中菜单的最后一项,并触发两次onSelect事件。并且后续的onClick和onSelect事件都失效了。也无法再选中其他项菜单。
📷 复现步骤 | Recurrence steps
🏞 期望结果 | Expected results
💻 复现代码 | Recurrence code
//从服务器获取菜单数据
menu: {
// 每当 initialState?.currentUser?.userid 发生修改时重新执行 request
params: {
// userId: initialState
},
// eslint-disable-next-line @typescript-eslint/no-unused-vars
request: async (params: void, defaultMenuData: any) => {
const menus = await getMenuList().then((res: any) => {
return res.data.map((item: any) => {
subMenuArr.push(item.id)
return {
path: '/',
name: item.meta.title,
icon: React.createElement(allIcons['SettingOutlined']),
key: item.name + item.meta.title,
routes: item.children.map((element: any) => {
return {
// path: '/?path=' + element.fullUrl,
// path: 'https://procomponents.ant.design/components/layout',
path: '/',
name: element.meta.title,
key: element.name + element.meta.title,
};
}),
};
});
});
// initialState.currentUser 中包含了所有用户信息
setInitialState({ ...initialState, rootSubmenuKeys: subMenuArr })
return menus;
},
onClick: ({ item }: { item: any }) => {
console.log(item, 'item,选中菜单');
},
},
© 版本信息
🚑 其他信息
The text was updated successfully, but these errors were encountered: