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
c294c85b
Commit
c294c85b
authored
Jul 23, 2018
by
yoyo837
Committed by
ιεΈ
Jul 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
FooterToolBar width is fixed at 100% when using rc-drawer SliderMenu.
parent
ae385751
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
24 deletions
+34
-24
src/components/FooterToolbar/index.js
src/components/FooterToolbar/index.js
+33
-1
src/routes/Forms/AdvancedForm.js
src/routes/Forms/AdvancedForm.js
+1
-23
No files found.
src/components/FooterToolbar/index.js
View file @
c294c85b
import
React
,
{
Component
}
from
'
react
'
;
import
PropTypes
from
'
prop-types
'
;
import
classNames
from
'
classnames
'
;
import
styles
from
'
./index.less
'
;
export
default
class
FooterToolbar
extends
Component
{
static
contextTypes
=
{
isMobile
:
PropTypes
.
bool
,
};
state
=
{
width
:
undefined
,
};
componentDidMount
()
{
window
.
addEventListener
(
'
resize
'
,
this
.
resizeFooterToolbar
);
this
.
resizeFooterToolbar
();
}
componentWillUnmount
()
{
window
.
removeEventListener
(
'
resize
'
,
this
.
resizeFooterToolbar
);
}
resizeFooterToolbar
=
()
=>
{
const
sider
=
document
.
querySelector
(
'
.ant-layout-sider
'
);
if
(
sider
==
null
)
{
return
;
}
const
{
isMobile
}
=
this
.
context
;
const
width
=
isMobile
?
null
:
`calc(100% -
${
sider
.
style
.
width
}
)`
;
const
{
width
:
stateWidth
}
=
this
.
state
;
if
(
stateWidth
!==
width
)
{
this
.
setState
({
width
});
}
};
render
()
{
const
{
children
,
className
,
extra
,
...
restProps
}
=
this
.
props
;
const
{
width
}
=
this
.
state
;
return
(
<
div
className
=
{
classNames
(
className
,
styles
.
toolbar
)}
{...
restProps
}
>
<
div
className
=
{
classNames
(
className
,
styles
.
toolbar
)}
style
=
{{
width
}}
{...
restProps
}
>
<
div
className
=
{
styles
.
left
}
>
{
extra
}
<
/div
>
<
div
className
=
{
styles
.
right
}
>
{
children
}
<
/div
>
<
/div
>
...
...
src/routes/Forms/AdvancedForm.js
View file @
c294c85b
...
...
@@ -58,29 +58,7 @@ const tableData = [
];
class
AdvancedForm
extends
PureComponent
{
state
=
{
width
:
'
100%
'
,
};
componentDidMount
()
{
window
.
addEventListener
(
'
resize
'
,
this
.
resizeFooterToolbar
);
}
componentWillUnmount
()
{
window
.
removeEventListener
(
'
resize
'
,
this
.
resizeFooterToolbar
);
}
resizeFooterToolbar
=
()
=>
{
const
sider
=
document
.
querySelectorAll
(
'
.ant-layout-sider
'
)[
0
];
const
width
=
`calc(100% -
${
sider
.
style
.
width
}
)`
;
const
{
width
:
stateWidth
}
=
this
.
state
;
if
(
stateWidth
!==
width
)
{
this
.
setState
({
width
});
}
};
render
()
{
const
{
width
:
stateWidth
}
=
this
.
state
;
const
{
form
,
dispatch
,
submitting
}
=
this
.
props
;
const
{
getFieldDecorator
,
validateFieldsAndScroll
,
getFieldsError
}
=
form
;
const
validate
=
()
=>
{
...
...
@@ -289,7 +267,7 @@ class AdvancedForm extends PureComponent {
initialValue
:
tableData
,
})(
<
TableForm
/>
)}
<
/Card
>
<
FooterToolbar
style
=
{{
width
:
stateWidth
}}
>
<
FooterToolbar
>
{
getErrorInfo
()}
<
Button
type
=
"
primary
"
onClick
=
{
validate
}
loading
=
{
submitting
}
>
ζδΊ€
...
...
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