Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
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
c67c7699
Commit
c67c7699
authored
7 years ago
by
WhatAKitty
Committed by
afc163
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load models on demand
parent
7808f663
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
8 deletions
+68
-8
src/common/nav.js
src/common/nav.js
+61
-1
src/index.js
src/index.js
+2
-5
src/router.js
src/router.js
+5
-2
No files found.
src/common/nav.js
View file @
c67c7699
...
...
@@ -3,11 +3,14 @@ import dynamic from 'dva/dynamic';
const
data
=
[{
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/user
'
),
],
component
:
()
=>
import
(
'
../layouts/BasicLayout
'
),
}),
layout
:
'
BasicLayout
'
,
name
:
'
ι¦ι‘΅
'
,
// for breadcrumb
path
:
''
,
path
:
'
/
'
,
children
:
[{
name
:
'
Dashboard
'
,
icon
:
'
dashboard
'
,
...
...
@@ -17,6 +20,9 @@ const data = [{
path
:
'
analysis
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/chart
'
),
],
component
:
()
=>
import
(
'
../routes/Dashboard/Analysis
'
),
}),
},
{
...
...
@@ -24,6 +30,9 @@ const data = [{
path
:
'
monitor
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/monitor
'
),
],
component
:
()
=>
import
(
'
../routes/Dashboard/Monitor
'
),
}),
},
{
...
...
@@ -31,6 +40,11 @@ const data = [{
path
:
'
workplace
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/project
'
),
import
(
'
../models/activities
'
),
import
(
'
../models/chart
'
),
],
component
:
()
=>
import
(
'
../routes/Dashboard/Workplace
'
),
}),
}],
...
...
@@ -43,6 +57,9 @@ const data = [{
path
:
'
basic-form
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/form
'
),
],
component
:
()
=>
import
(
'
../routes/Forms/BasicForm
'
),
}),
},
{
...
...
@@ -50,18 +67,27 @@ const data = [{
path
:
'
step-form
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/form
'
),
],
component
:
()
=>
import
(
'
../routes/Forms/StepForm
'
),
}),
children
:
[{
path
:
'
confirm
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/form
'
),
],
component
:
()
=>
import
(
'
../routes/Forms/StepForm/Step2
'
),
}),
},
{
path
:
'
result
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/form
'
),
],
component
:
()
=>
import
(
'
../routes/Forms/StepForm/Step3
'
),
}),
}],
...
...
@@ -70,6 +96,9 @@ const data = [{
path
:
'
advanced-form
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/form
'
),
],
component
:
()
=>
import
(
'
../routes/Profile/AdvancedProfile
'
),
}),
}],
...
...
@@ -82,6 +111,9 @@ const data = [{
path
:
'
table-list
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/rule
'
),
],
component
:
()
=>
import
(
'
../routes/List/TableList
'
),
}),
},
{
...
...
@@ -89,6 +121,9 @@ const data = [{
path
:
'
basic-list
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/list
'
),
],
component
:
()
=>
import
(
'
../routes/List/BasicList
'
),
}),
},
{
...
...
@@ -96,6 +131,9 @@ const data = [{
path
:
'
card-list
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/list
'
),
],
component
:
()
=>
import
(
'
../routes/List/CardList
'
),
}),
},
{
...
...
@@ -103,6 +141,9 @@ const data = [{
path
:
'
cover-card-list
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/list
'
),
],
component
:
()
=>
import
(
'
../routes/List/CoverCardList
'
),
}),
},
{
...
...
@@ -110,6 +151,9 @@ const data = [{
path
:
'
filter-card-list
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/list
'
),
],
component
:
()
=>
import
(
'
../routes/List/FilterCardList
'
),
}),
},
{
...
...
@@ -117,6 +161,9 @@ const data = [{
path
:
'
search
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/list
'
),
],
component
:
()
=>
import
(
'
../routes/List/SearchList
'
),
}),
}],
...
...
@@ -129,6 +176,9 @@ const data = [{
path
:
'
basic
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/profile
'
),
],
component
:
()
=>
import
(
'
../routes/Profile/BasicProfile
'
),
}),
},
{
...
...
@@ -136,6 +186,9 @@ const data = [{
path
:
'
advanced
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/profile
'
),
],
component
:
()
=>
import
(
'
../routes/Profile/AdvancedProfile
'
),
}),
}],
...
...
@@ -190,6 +243,7 @@ const data = [{
app
,
component
:
()
=>
import
(
'
../layouts/UserLayout
'
),
}),
path
:
'
/user
'
,
layout
:
'
UserLayout
'
,
children
:
[{
name
:
'
εΈζ·
'
,
...
...
@@ -200,6 +254,9 @@ const data = [{
path
:
'
login
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/login
'
),
],
component
:
()
=>
import
(
'
../routes/User/Login
'
),
}),
},
{
...
...
@@ -207,6 +264,9 @@ const data = [{
path
:
'
register
'
,
component
:
app
=>
dynamic
({
app
,
models
:
()
=>
[
import
(
'
../models/register
'
),
],
component
:
()
=>
import
(
'
../routes/User/Register
'
),
}),
},
{
...
...
This diff is collapsed.
Click to expand it.
src/index.js
View file @
c67c7699
import
dva
from
'
dva
'
;
import
'
moment/locale/zh-cn
'
;
import
models
from
'
./models
'
;
import
'
./polyfill
'
;
import
'
./g2
'
;
// import { browserHistory } from 'dva/router';
...
...
@@ -14,10 +13,8 @@ const app = dva({
// 2. Plugins
// app.use({});
// 3. Model move to router
models
.
forEach
((
m
)
=>
{
app
.
model
(
m
);
});
// 3. Register global model
app
.
model
(
require
(
'
./models/global
'
));
// 4. Router
app
.
router
(
require
(
'
./router
'
));
...
...
This diff is collapsed.
Click to expand it.
src/router.js
View file @
c67c7699
...
...
@@ -7,6 +7,9 @@ import dynamic from 'dva/dynamic';
function
RouterConfig
({
history
,
app
})
{
const
BasicLayout
=
dynamic
({
app
,
models
:
()
=>
[
import
(
'
./models/user
'
),
],
component
:
()
=>
import
(
'
./layouts/BasicLayout
'
),
});
const
UserLayout
=
dynamic
({
...
...
@@ -18,8 +21,8 @@ function RouterConfig({ history, app }) {
<
LocaleProvider
locale
=
{
zhCN
}
>
<
Router
history
=
{
history
}
>
<
Switch
>
<
Route
path
=
"
/user
"
component
=
{
UserLayout
}
/
>
<
Route
path
=
"
/
"
component
=
{
BasicLayout
}
/
>
<
Route
path
=
"
/user
"
render
=
{
props
=>
<
UserLayout
{...
props
}
app
=
{
app
}
/>
} /
>
<
Route
path
=
"
/
"
render
=
{
props
=>
<
BasicLayout
{...
props
}
app
=
{
app
}
/>
} /
>
<
/Switch
>
<
/Router
>
<
/LocaleProvider
>
...
...
This diff is collapsed.
Click to expand it.
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