From 3bf124dbb31cb7184927458e6c641849143812aa Mon Sep 17 00:00:00 2001 From: Dreamacro <305009791@qq.com> Date: Sat, 8 Dec 2018 22:29:08 +0800 Subject: [PATCH] Fix: selector & rerender --- src/components/Select/index.tsx | 7 +------ src/containers/Proxies/index.tsx | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/components/Select/index.tsx b/src/components/Select/index.tsx index 9194775..aee1142 100644 --- a/src/components/Select/index.tsx +++ b/src/components/Select/index.tsx @@ -40,10 +40,6 @@ export class Select extends React.Component { hasCreateDropList: false } - constructor (props) { - super(props) - } - componentDidMount () { document.addEventListener('click', this.handleGlobalClick, true) this.setState({ dropdownListStyles: this.calculateAttachmentPosition() }) @@ -91,8 +87,7 @@ export class Select extends React.Component { return { top: Math.floor(targetRectInfo.top) - 10, - left: Math.floor(targetRectInfo.left) - 10, - width: Math.floor(targetRectInfo.width) + 10 + left: Math.floor(targetRectInfo.left) - 10 } } diff --git a/src/containers/Proxies/index.tsx b/src/containers/Proxies/index.tsx index 56f0f41..bae201e 100644 --- a/src/containers/Proxies/index.tsx +++ b/src/containers/Proxies/index.tsx @@ -47,10 +47,10 @@ class Proxies extends React.Component { { - config.state === 'ok' &&
    + config.config.proxy.length !== 0 &&
      { config.config.proxy.map((p, index) => ( -
    • +
    • this.setState({ showModifyProxyDialog: true, activeConfig: p, @@ -65,15 +65,15 @@ class Proxies extends React.Component {
      - - { - showModifyProxyDialog && this.setState({ showModifyProxyDialog: false, activeConfig: null, activeConfigIndex: -1 })} - /> - } + + { + showModifyProxyDialog && this.setState({ showModifyProxyDialog: false, activeConfig: null, activeConfigIndex: -1 })} + /> + } ) }