afc163 8 лет назад
Родитель
Сommit
0a4622420c
2 измененных файлов с 17 добавлено и 2 удалено
  1. 0 1
      src/components/FooterToolbar/index.less
  2. 17 1
      src/routes/Forms/AdvancedForm.js

+ 0 - 1
src/components/FooterToolbar/index.less

@@ -11,7 +11,6 @@
   background: #fff;
   border-top: 1px solid @border-color-split;
   padding: 0 24px;
-  transition: all .3s;
   z-index: 9;
 
   &:after {

+ 17 - 1
src/routes/Forms/AdvancedForm.js

@@ -42,6 +42,22 @@ 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})`;
+    if (this.state.width !== width) {
+      this.setState({ width });
+    }
+  }
   render() {
     const { form, dispatch, submitting } = this.props;
     const { getFieldDecorator, validateFieldsAndScroll, getFieldsError } = form;
@@ -257,7 +273,7 @@ class AdvancedForm extends PureComponent {
             initialValue: tableData,
           })(<TableForm />)}
         </Card>
-        <FooterToolbar>
+        <FooterToolbar style={{ width: this.state.width }}>
           {getErrorInfo()}
           <Button type="primary" onClick={validate} loading={submitting}>
             提交