Переглянути джерело

bugfix: fix SettingDrawer style error

chen shuai 6 роки тому
батько
коміт
2230313984

+ 17 - 12
src/components/SettingDrawer/index.js

@@ -1,4 +1,4 @@
-import React, { PureComponent } from 'react';
+import React, { Component } from 'react';
 import { Select, message, Drawer, List, Switch, Divider, Icon, Button, Alert, Tooltip } from 'antd';
 import { formatMessage } from 'umi/locale';
 import { CopyToClipboard } from 'react-copy-to-clipboard';
@@ -23,7 +23,7 @@ const Body = ({ children, title, style }) => (
 );
 
 @connect(({ setting }) => ({ setting }))
-class SettingDrawer extends PureComponent {
+class SettingDrawer extends Component {
   state = {
     collapse: false,
   };
@@ -207,17 +207,22 @@ class SettingDrawer extends PureComponent {
           <Divider />
 
           <Body title={formatMessage({ id: 'app.setting.othersettings' })}>
-            <List.Item
-              actions={[
-                <Switch
-                  size="small"
-                  checked={!!colorWeak}
-                  onChange={checked => this.changeSetting('colorWeak', checked)}
-                />,
+            <List
+              split={false}
+              renderItem={this.renderLayoutSettingItem}
+              dataSource={[
+                {
+                  title: formatMessage({ id: 'app.setting.weakmode' }),
+                  action: (
+                    <Switch
+                      size="small"
+                      checked={!!colorWeak}
+                      onChange={checked => this.changeSetting('colorWeak', checked)}
+                    />
+                  ),
+                },
               ]}
-            >
-              {formatMessage({ id: 'app.setting.weakmode' })}
-            </List.Item>
+            />
           </Body>
           <Divider />
           <CopyToClipboard

+ 7 - 0
src/components/SettingDrawer/index.less

@@ -4,6 +4,13 @@
   position: relative;
   min-height: 100%;
   background: #fff;
+  :global {
+    .ant-list-item {
+      span {
+        flex: 1;
+      }
+    }
+  }
 }
 
 .blockChecbox {