-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
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
feat: support route wrappers #3189
Conversation
let mergedRouteWrappers = routeWrappers; | ||
if (route.wrappers && route.wrappers.length) { | ||
mergedRouteWrappers = routeWrappers.concat(route.wrappers); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
验证 pageConfig 的功能
@imsobear 这里只是收集 wrappers 阶段,最后会在这里统一挂载 pageConfig
function wrapperRoute(component, routerWrappers) { |
@ClarkXia 「约定式」和「配置式」都支持了 wrappers 属性,统一通过 pageConfig 进行配置: HomePage.pageConfig = {
// 支持多个
wrappers: [],
} |
title: 'Dashboard Page', | ||
wrappers: [wrapperPage] | ||
}; | ||
|
||
export default Dashboard; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
跟这种方式 export default wrapperPage(Dashboard)
对比,唯一的优势就是不需要处理 pageConfig
结论
|
@@ -39,9 +39,13 @@ function getRouteComponent(component, routerWrappers?: IRouteWrapper[]) { | |||
function parseRoutes(routes: RouteItemProps[]) { | |||
return routes.map((route) => { | |||
const { children, component, routeWrappers, ...others } = route; | |||
let mergedRouteWrappers = routeWrappers; | |||
if (route.wrappers && route.wrappers.length) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrappers 跟 routeWrappers 类似应该没必要透传下去了,目前 others
中还包含这项内容?
* fix: compatible with the index page * fix: create histroy when render root app * feat: support promise function with useRequest (#3188) * fix: repository url (#3192) * feat: optimize webpackbar (#3187) * feat: optimize webpackbar * fix: rename eslintLoaderOptions to eslint * fix: upgrate react-dev-utils (#3190) * fix: upgrate react-dev-utils * v1.2.2-alpha.1 * fix: set transportMode to ws Co-authored-by: ClarkXia <xiawenwu41@gmail.com> * feat: support route wrappers (#3189) * feat: support route wrappers * feat: support pageConfig wrappers * refactor: wrappers api * docs: add wrappers api to ruotes * fix: destructuring routes * feat: enhance use request types (#3195) * feat: enhance useRequest types * chore: remove comments * docs: useRequest usage * v1.2.2-alpha.2 * docs: add withFullResponse api * docs: refactor request docs * chore: typo * chore: useRequest docs * docs: fix typo * docs: optimize title * v1.2.2-alpha.3 * Fix/release bugs (#3205) * fix: types & log * v1.2.2-alpha.4 * fix: no match single page file
No description provided.