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
0196493a
Commit
0196493a
authored
Aug 02, 2018
by
KJlmfe
Committed by
εε³
Aug 02, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor: connect,Form.create use decorator
parent
784d71e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
24 deletions
+21
-24
src/layouts/BasicLayout.js
src/layouts/BasicLayout.js
+7
-8
src/routes/Forms/AdvancedForm.js
src/routes/Forms/AdvancedForm.js
+6
-6
src/routes/Forms/StepForm/Step1.js
src/routes/Forms/StepForm/Step1.js
+4
-5
src/routes/Forms/StepForm/Step3.js
src/routes/Forms/StepForm/Step3.js
+4
-5
No files found.
src/layouts/BasicLayout.js
View file @
0196493a
...
@@ -88,7 +88,13 @@ enquireScreen(b => {
...
@@ -88,7 +88,13 @@ enquireScreen(b => {
isMobile
=
b
;
isMobile
=
b
;
});
});
class
BasicLayout
extends
React
.
PureComponent
{
@
connect
(({
user
,
global
=
{},
loading
})
=>
({
currentUser
:
user
.
currentUser
,
collapsed
:
global
.
collapsed
,
fetchingNotices
:
loading
.
effects
[
'
global/fetchNotices
'
],
notices
:
global
.
notices
,
}))
export
default
class
BasicLayout
extends
React
.
PureComponent
{
static
childContextTypes
=
{
static
childContextTypes
=
{
location
:
PropTypes
.
object
,
location
:
PropTypes
.
object
,
breadcrumbNameMap
:
PropTypes
.
object
,
breadcrumbNameMap
:
PropTypes
.
object
,
...
@@ -301,10 +307,3 @@ class BasicLayout extends React.PureComponent {
...
@@ -301,10 +307,3 @@ class BasicLayout extends React.PureComponent {
);
);
}
}
}
}
export
default
connect
(({
user
,
global
=
{},
loading
})
=>
({
currentUser
:
user
.
currentUser
,
collapsed
:
global
.
collapsed
,
fetchingNotices
:
loading
.
effects
[
'
global/fetchNotices
'
],
notices
:
global
.
notices
,
}))(
BasicLayout
);
src/routes/Forms/AdvancedForm.js
View file @
0196493a
...
@@ -57,7 +57,12 @@ const tableData = [
...
@@ -57,7 +57,12 @@ const tableData = [
},
},
];
];
class
AdvancedForm
extends
PureComponent
{
@
connect
(({
global
,
loading
})
=>
({
collapsed
:
global
.
collapsed
,
submitting
:
loading
.
effects
[
'
form/submitAdvancedForm
'
],
}))
@
Form
.
create
()
export
default
class
AdvancedForm
extends
PureComponent
{
render
()
{
render
()
{
const
{
form
,
dispatch
,
submitting
}
=
this
.
props
;
const
{
form
,
dispatch
,
submitting
}
=
this
.
props
;
const
{
getFieldDecorator
,
validateFieldsAndScroll
,
getFieldsError
}
=
form
;
const
{
getFieldDecorator
,
validateFieldsAndScroll
,
getFieldsError
}
=
form
;
...
@@ -277,8 +282,3 @@ class AdvancedForm extends PureComponent {
...
@@ -277,8 +282,3 @@ class AdvancedForm extends PureComponent {
);
);
}
}
}
}
export
default
connect
(({
global
,
loading
})
=>
({
collapsed
:
global
.
collapsed
,
submitting
:
loading
.
effects
[
'
form/submitAdvancedForm
'
],
}))(
Form
.
create
()(
AdvancedForm
));
src/routes/Forms/StepForm/Step1.js
View file @
0196493a
...
@@ -15,8 +15,11 @@ const formItemLayout = {
...
@@ -15,8 +15,11 @@ const formItemLayout = {
},
},
};
};
@
connect
(({
form
})
=>
({
data
:
form
.
step
,
}))
@
Form
.
create
()
@
Form
.
create
()
class
Step1
extends
React
.
PureComponent
{
export
default
class
Step1
extends
React
.
PureComponent
{
render
()
{
render
()
{
const
{
form
,
dispatch
,
data
}
=
this
.
props
;
const
{
form
,
dispatch
,
data
}
=
this
.
props
;
const
{
getFieldDecorator
,
validateFields
}
=
form
;
const
{
getFieldDecorator
,
validateFields
}
=
form
;
...
@@ -108,7 +111,3 @@ class Step1 extends React.PureComponent {
...
@@ -108,7 +111,3 @@ class Step1 extends React.PureComponent {
);
);
}
}
}
}
export
default
connect
(({
form
})
=>
({
data
:
form
.
step
,
}))(
Step1
);
src/routes/Forms/StepForm/Step3.js
View file @
0196493a
...
@@ -5,7 +5,10 @@ import { routerRedux } from 'dva/router';
...
@@ -5,7 +5,10 @@ import { routerRedux } from 'dva/router';
import
Result
from
'
components/Result
'
;
import
Result
from
'
components/Result
'
;
import
styles
from
'
./style.less
'
;
import
styles
from
'
./style.less
'
;
class
Step3
extends
React
.
PureComponent
{
@
connect
(({
form
})
=>
({
data
:
form
.
step
,
}))
export
default
class
Step3
extends
React
.
PureComponent
{
render
()
{
render
()
{
const
{
dispatch
,
data
}
=
this
.
props
;
const
{
dispatch
,
data
}
=
this
.
props
;
const
onFinish
=
()
=>
{
const
onFinish
=
()
=>
{
...
@@ -67,7 +70,3 @@ class Step3 extends React.PureComponent {
...
@@ -67,7 +70,3 @@ class Step3 extends React.PureComponent {
);
);
}
}
}
}
export
default
connect
(({
form
})
=>
({
data
:
form
.
step
,
}))(
Step3
);
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