Comments (7)
是我menuData的原因
from ant-design-pro-plus.
抱歉,我研究了一下,源码你也能看见,就是直接渲染的 Tabs 组件切换就行了,暂时不知道是什么原因导致的,好歹知道原因才能操作啊 😂
from ant-design-pro-plus.
@zpr1g 谢谢!您的代码是ts的,我的项目是js的,我引入了master分支的后菜单名都是"未命名",我的菜单是动态配置的. 要怎么解决呢?
from ant-design-pro-plus.
动态配置是啥意思?我这个菜单逻辑都是 pro 原生的用法啊,你是改过什么东西吧
from ant-design-pro-plus.
/** 根据路由定义中的 name 本地化标题 */
function localeRoutes(routes: Route[], parent: MenuDataItem | null = null): MenuDataItem[] {
const result: MenuDataItem[] = [];
console.log("routes");
console.log(routes)
routes.forEach(item => {
const { routes: itemRoutes, ...rest } = item;
if (!rest.path || rest.redirect) {
return;
}
// 初始化 locale 字段
let newItem: MenuDataItem = {
...rest,
routes: null,
locale: item.name,
};
const getLocaleId = () => {
if (!parent && newItem.locale) {
return `menu.${newItem.locale}`;
}
if (parent && parent.locale) {
return newItem.locale ? `${parent.locale}.${newItem.locale}` : parent.locale;
}
return undefined;
};
newItem = {
...rest,
locale: getLocaleId(),
name: getLocaleId() ? formatMessage({ id: getLocaleId()! }) : '未命名',
};
if (Array.isArray(itemRoutes) && itemRoutes.length) {
newItem = {
...newItem,
children: localeRoutes(itemRoutes, newItem),
};
}
result.push(newItem);
});
return result;
}
name: getLocaleId() ? formatMessage({ id: getLocaleId()! }) : '未命名',这一行的getLocaleId是空的, 我改成item.name这个值也是空的, 要怎么获取菜单名呢?
还有点开一个菜单/system/user/list,会同时打开这两个菜单,/system/user和 /system/user/list, 是什么原因导致的? 谢谢 @zpr1g
from ant-design-pro-plus.
@gclsoft 你好,我最近测试发现在 [email protected] 的时候是不会闪烁的,所以在 antd 仓库提了 issue 找到了原因。如果还用得着的话,你也可以看看。
from ant-design-pro-plus.
谢谢!
from ant-design-pro-plus.
Related Issues (20)
- 请问支持微前端 qiankun 吗 HOT 2
- 动态路由不支持 HOT 3
- nested routes? HOT 5
- 体验不好,如果页面内容比较多,出现滚动条,tabs也跟着滚动了 HOT 3
- 项目启动报错 HOT 7
- v4-legacy 怎么语言问题
- 请问一下,刷新页面时如何保留当前页面,将其他页面关闭 HOT 2
- history传参query操作路由后,跳转到的页面标签页出现异常 HOT 7
- 关闭当前标签页并同时跳转到另一个标签页 HOT 4
- 如何判断现在停留在哪个标签页? HOT 3
- 如何再路由中设置,不要再页面中设置 HOT 11
- 在页面中使用不出现多标签栏是怎么回事,试了好多遍,不知道哪里出问题了 HOT 2
- 对antd pro layout 是mix的,tab会多出一个 HOT 8
- 项目升级到umi4后,无法缓存页面 HOT 1
- 通过footerRender配置页脚,无法在routes中根据路由隐藏 HOT 2
- isSwitchTab 判断异常 HOT 7
- vite 是否可以配置 antd-vue 按需求加载 HOT 6
- 问题:请问config/config.dev.ts是干嘛的? HOT 2
- 使用多标签页功能时,menu请求不生效 HOT 1
- antd pro v5 umi4 在app.tsx 中如何获取 route HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ant-design-pro-plus.