Comments (13)
onSettingsChange 应该是 SettingsDrawer 暴露的 API,Layout 组件里不应该有这个逻辑。如果 SettingsDrawer 是包含在 Layout 里,建议分开,不要放在一起。
import ProLayout from '...';
import SettingsDrawer from '...';
<ProLayout>
<SettingsDrawer onChange={...} />
</ProLayout>
from ant-design-pro-layout.
也跟着现有的 API 风格来吧:ant-design/ant-design#16048
- * onLayoutCollapsedChange => onCollapse
- * renderXXX => xxxRender
- * breadcrumbNameMap => breadcrumb (PageHeader 里只有
routes
,可以强化一下继续同一个名字)
from ant-design-pro-layout.
headerRender 现在可以支持两个参数。 一个是默认的props。
<BasicLayout
headerRender={(props, defaultDom) => (
<div>
{props.logo} {props.rightContentRender(props)}
</div>
)}
/>;
from ant-design-pro-layout.
settings 主要还是为了方面进行 onchange。配置的时候一般都会设置一个 setting.js 之类的配置。
如果打平。管理 prop 时就会很蛋疼。
state = {
settings:{}
}
<BasicLayout
settings={this.state.settings}
onChangeSetting={(settings)=>this.setState({settings})}
/>
from ant-design-pro-layout.
暴露成 onXxxxChange
onYyyyChange
好了,API 多一点没关系,更清晰一点。实际上不是所有配置都在 drawer 里。
from ant-design-pro-layout.
favicon 应该是 html添加的,我们的 logo 是自己定义的一种规范
breadcrumbNameMap 可以根据 path 来或者当前的菜单信息,拿到 name icon 等信息
from ant-design-pro-layout.
暴露成 onXxxxChange onYyyyChange 好了,API 多一点没关系,更清晰一点。实际上不是所有配置都在 drawer 里。
过于繁杂了。我们有很多配置,以后估计还会增加。
from ant-design-pro-layout.
breadcrumbNameMap 不写的话,是否有面包屑?
面包屑是否能默认从 config 里的路由 title 里读出来?
breadcrumbNameMap 这样的 API 如何解决国际化问题?
这几个问题没想清楚的话,不要着急加这个 API。现在看不太懂,也不知道怎么用。
from ant-design-pro-layout.
breadcrumbNameMap 是 umi 从 config 里面生成的然后注入到 layout 中的。
breadcrumbNameMap 不传的话是没有面包屑的。
全球化原来的解法是根据 menu 的层级拼成一个 locale 字符串。
{
path: '/user',
component: '../layouts/UserLayout',
routes: [
{ path: '/user', redirect: '/user/login' },
{ path: '/user/login', name: 'login', component: './User/Login' },
],
},
这个就会生成一个 { locale : "user.logon" }, 然后从 react-init 里面拿
from ant-design-pro-layout.
props 命名看上去很奇怪。这样要只修改一部分或者加点东西会变得很难,要嘛不改要嘛全改。
from ant-design-pro-layout.
pro 的 header 现在比较复杂。
在topMenu的模式中 header中还有menu ,不只是 left heade 和 right header.
只给 props 让其全部自定义是最合适的方案。大部分的情况使用 rightContentRender 都能解决
from ant-design-pro-layout.
SettingsDrawer 变成一个独立组件 ,请问如何安装、使用?
from ant-design-pro-layout.
breadcrumbNameMap 是umi依据route生成的吗?
from ant-design-pro-layout.
Related Issues (20)
- 👑 [需求]希望能在菜单栏上增加一个分类的功能 HOT 2
- 🐛[BUG]6.2.4在mix模式下,第一次进入未选中默认选中的项 HOT 3
- 🐛[BUG]文档 pro-layout 的layout 值应该为 topmenu 和 sidemenu
- 🧐[问题] Upgrade from 5.0.19 to 6.2.4 breaks side-bar menu (从5.0.19升级到6.2.4会中断侧边栏菜单) HOT 2
- 🐛[BUG] V6.2.5 页面首次加载完,首次点击菜单会再次加载菜单,会闪烁一下 HOT 3
- 750分辨率下出现2个logo?🧐[问题]
- 👑 [需求]
- 🐛[BUG]ProLayout 6.2.5 SiderMenu的openKeys selectedKeys无法及时更新 HOT 5
- 🐛[BUG]配置子菜单icon不显示 HOT 5
- 🧐[问题] 点击面包屑,为什么会是整个页面刷新跳转,而不是局部刷新?
- 左侧菜单选中的bug🐛[BUG] HOT 2
- V6.2.5 typescript报错 HOT 4
- 🧐[问题]我不想让PageHeaderWrapper显示出来该怎么做? HOT 1
- 🐛[BUG] menuDataRender采用后台获取左侧菜单,第一次进入以及刷新页面,选中菜单未高亮 HOT 1
- 🧐[问题]菜单是否可以加参数? HOT 3
- 🐛[BUG] layout 属性设置为 top或mix没变化
- 🧐[问题] PageHeaderWrapper如何去掉 title,只保留面包屑 HOT 1
- 此仓库已废弃,访问 https://procomponent.ant.design/layout 了解更多 HOT 4
- 🐛[BUG] 好像还是可以新增? HOT 1
- 🧐 defaultOpenAll 选项在切换页面之后失效了 HOT 1
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-layout.