From 2fbc37b0b4201874b0a38a4afa208dbb35f42172 Mon Sep 17 00:00:00 2001 From: jim Date: Mon, 4 Jun 2018 18:48:31 +0800 Subject: [PATCH] fix eslint error --- src/components/EditableLinkGroup/index.js | 11 +++++------ src/components/HeaderSearch/index.js | 20 +++++++++++--------- src/components/Login/index.js | 15 +++++++++------ src/components/NoticeIcon/index.js | 3 ++- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/src/components/EditableLinkGroup/index.js b/src/components/EditableLinkGroup/index.js index e230c3dd..2d0b4aa8 100644 --- a/src/components/EditableLinkGroup/index.js +++ b/src/components/EditableLinkGroup/index.js @@ -6,18 +6,17 @@ import styles from './index.less'; // TODO: 添加逻辑 class EditableLinkGroup extends PureComponent { - static defaultProps = { - links: [], - onAdd: () => {}, - linkElement: 'a', - }; - static propTypes = { links: PropTypes.array, onAdd: PropTypes.func, linkElement: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), }; + static defaultProps = { + links: [], + onAdd: () => {}, + linkElement: 'a', + }; render() { const { links, linkElement, onAdd } = this.props; return ( diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js index 295a837a..855e7ac1 100644 --- a/src/components/HeaderSearch/index.js +++ b/src/components/HeaderSearch/index.js @@ -5,15 +5,6 @@ import classNames from 'classnames'; import styles from './index.less'; export default class HeaderSearch extends PureComponent { - static defaultProps = { - defaultActiveFirstOption: false, - onPressEnter: () => {}, - onSearch: () => {}, - className: '', - placeholder: '', - dataSource: [], - defaultOpen: false, - }; static propTypes = { className: PropTypes.string, placeholder: PropTypes.string, @@ -23,6 +14,17 @@ export default class HeaderSearch extends PureComponent { dataSource: PropTypes.array, defaultOpen: PropTypes.bool, }; + + static defaultProps = { + defaultActiveFirstOption: false, + onPressEnter: () => {}, + onSearch: () => {}, + className: '', + placeholder: '', + dataSource: [], + defaultOpen: false, + }; + state = { searchMode: this.props.defaultOpen, value: '', diff --git a/src/components/Login/index.js b/src/components/Login/index.js index 02aa80c2..58c4e468 100644 --- a/src/components/Login/index.js +++ b/src/components/Login/index.js @@ -8,23 +8,26 @@ import LoginSubmit from './LoginSubmit'; import styles from './index.less'; class Login extends Component { - static defaultProps = { - className: '', - defaultActiveKey: '', - onTabChange: () => {}, - onSubmit: () => {}, - }; static propTypes = { className: PropTypes.string, defaultActiveKey: PropTypes.string, onTabChange: PropTypes.func, onSubmit: PropTypes.func, }; + static childContextTypes = { tabUtil: PropTypes.object, form: PropTypes.object, updateActive: PropTypes.func, }; + + static defaultProps = { + className: '', + defaultActiveKey: '', + onTabChange: () => {}, + onSubmit: () => {}, + }; + state = { type: this.props.defaultActiveKey, tabs: [], diff --git a/src/components/NoticeIcon/index.js b/src/components/NoticeIcon/index.js index be2f44f9..a207be86 100644 --- a/src/components/NoticeIcon/index.js +++ b/src/components/NoticeIcon/index.js @@ -7,6 +7,8 @@ import styles from './index.less'; const { TabPane } = Tabs; export default class NoticeIcon extends PureComponent { + static Tab = TabPane; + static defaultProps = { onItemClick: () => {}, onPopupVisibleChange: () => {}, @@ -19,7 +21,6 @@ export default class NoticeIcon extends PureComponent { }, emptyImage: 'https://gw.alipayobjects.com/zos/rmsportal/wAhyIChODzsoKIOBHcBk.svg', }; - static Tab = TabPane; constructor(props) { super(props); this.state = {}; -- GitLab