Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
aa44bbb9
Commit
aa44bbb9
authored
Jul 04, 2018
by
愚道
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add layout
parent
677621d7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
84 additions
and
7 deletions
+84
-7
config/config.js
config/config.js
+60
-0
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+12
-7
src/layouts/index.js
src/layouts/index.js
+12
-0
No files found.
config/config.js
View file @
aa44bbb9
...
...
@@ -8,6 +8,7 @@ export default {
// add for transfer to umi
plugins
:
[
'
umi-plugin-dva
'
,
// TODO 决定是否使用约定路由,如果使用配置路由那么 umi-plugin-routes 可以去掉了
[
'
umi-plugin-routes
'
,
{
...
...
@@ -17,6 +18,65 @@ export default {
],
disableServiceWorker
:
true
,
// 路由配置
// TODO ./src/pages 太冗余了
// routes: [{
// path: '/',
// component: './src/layouts/BasicLayout',
// indexRoute: { redirect: '/dashboard/analysis' },
// childRoutes: [
// // dashboard
// { path: 'dashboard/analysis', component: './src/pages/Dashboard/Analysis' },
// { path: 'dashboard/monitor', component: './src/pages/Dashboard/Monitor' },
// { path: 'dashboard/workplace', component: './src/pages/Dashboard/Workplace' },
// // forms
// { path: 'form/basic-form', component: './src/pages/Forms/BasicForm' },
// {
// path: 'form/step-form',
// component: './src/pages/Forms/StepForm',
// indexRoute: { redirect: '/form/step-form/info' },
// childRoutes: [
// { path: 'info', component: './src/pages/Forms/StepForm/Step1' },
// { path: 'confirm', component: './src/pages/Forms/StepForm/Step2' },
// { path: 'result', component: './src/pages/Forms/StepForm/Step3' },
// ],
// },
// { path: 'form/advanced-form', component: './src/pages/Forms/AdvancedForm' },
// // list
// { path: 'list/table-list', component: './src/pages/List/TableList' },
// { path: 'list/table-list', component: './src/pages/List/TableList' },
// { path: 'list/basic-list', component: './src/pages/List/BasicList' },
// { path: 'list/card-list', component: './src/pages/List/CardList' },
// {
// path: 'list/search',
// component: './src/pages/List/List',
// indexRoute: { redirect: '/list/search/projects' },
// childRoutes: [
// { path: 'articles', component: './src/pages/List/Articles' },
// { path: 'projects', component: './src/pages/List/Projects' },
// { path: 'applications', component: './src/pages/List/Applications' },
// ],
// },
// // profile
// { path: 'profile/basic', component: './src/pages/Profile/BasicProfile' },
// { path: 'profile/advanced', component: './src/pages/Profile/AdvancedProfile' },
// // result
// { path: 'result/success', component: './src/pages/Result/Success' },
// { path: 'result/fail', component: './src/pages/Result/Error' },
// // exception
// { path: 'exception/403', component: './src/pages/Exception/403' },
// { path: 'exception/404', component: './src/pages/Exception/404' },
// { path: 'exception/500', component: './src/pages/Exception/500' },
// // ],
// }],
// copy from old webpackrc.js
// entry: 'src/index.js', // TODO remove
...
...
src/layouts/BasicLayout.js
View file @
aa44bbb9
/* eslint-disable no-unused-vars */
// TODO remove eslint-disable
import
React
from
'
react
'
;
import
{
Layout
}
from
'
antd
'
;
import
DocumentTitle
from
'
react-document-title
'
;
...
...
@@ -137,17 +139,19 @@ class BasicLayout extends React.PureComponent {
};
render
()
{
// TODO remove old router code
const
{
isMobile
,
redirectData
,
routerData
,
//
redirectData,
//
routerData,
silderTheme
,
layout
:
PropsLayout
,
match
,
children
,
// match,
}
=
this
.
props
;
const
isTop
=
PropsLayout
===
'
topmenu
'
;
const
bashRedirect
=
this
.
getBashRedirect
();
const
myRedirectData
=
redirectData
||
[];
//
const bashRedirect = this.getBashRedirect();
//
const myRedirectData = redirectData || [];
const
layout
=
(
<
Layout
>
{
isTop
&&
!
isMobile
?
null
:
(
...
...
@@ -162,7 +166,8 @@ class BasicLayout extends React.PureComponent {
<
Layout
style
=
{
this
.
getLayoutStyle
()}
>
<
Header
handleMenuCollapse
=
{
this
.
handleMenuCollapse
}
logo
=
{
logo
}
{...
this
.
props
}
/
>
<
Content
style
=
{
this
.
getContentStyle
()}
>
<
Switch
>
{
children
}
{
/* <Switch> TODO remove
{myRedirectData.map(item => (
<Redirect key={item.from} exact from={item.from} to={item.to} />
))}
...
...
@@ -178,7 +183,7 @@ class BasicLayout extends React.PureComponent {
))}
<Redirect exact from="/" to={bashRedirect} />
<Route render={NotFound} />
<
/Switch
>
</Switch>
*/
}
<
/Content
>
<
Footer
/>
<
/Layout
>
...
...
src/layouts/index.js
0 → 100644
View file @
aa44bbb9
import
React
from
'
react
'
;
import
BasecLayout
from
'
./BasicLayout
'
;
// TODO routerData menuData etc...
export
default
props
=>
{
const
{
location
,
children
}
=
props
;
return
(
<
BasecLayout
routerData
=
{{}}
menuData
=
{[]}
location
=
{
location
}
>
{
children
}
<
/BasecLayout
>
);
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment