site: update code style

This commit is contained in:
Benjy Cui 2016-03-30 16:16:18 +08:00
parent b1e73c876d
commit 1fbfb67744
4 changed files with 18 additions and 15 deletions

View File

@ -42,13 +42,16 @@ export default class ImagePreview extends React.Component {
leftVisible: false,
rightVisible: false,
};
this.handleLeftClick = this.handleClick.bind(this, 'left');
this.handleRightClick = this.handleClick.bind(this, 'right');
}
handleClick(side) {
this.setState({ [`${side}Visible`]: true });
}
handleCancel() {
handleCancel = () => {
this.setState({
leftVisible: false,
rightVisible: false,
@ -102,8 +105,8 @@ export default class ImagePreview extends React.Component {
cover={imagesList[0]}
coverMeta={imgsMeta[0]}
imgs={imagesList}
onClick={this.handleClick.bind(this, 'left')}
onCancel={this.handleCancel.bind(this)}
onClick={this.handleLeftClick}
onCancel={this.handleCancel}
/>
{
comparable ?
@ -113,8 +116,8 @@ export default class ImagePreview extends React.Component {
cover={imagesList[1]}
coverMeta={imgsMeta[1]}
imgs={imagesList}
onClick={this.handleClick.bind(this, 'right')}
onCancel={this.handleCancel.bind(this)}
onClick={this.handleRightClick}
onCancel={this.handleCancel}
/> : null
}
</div>

View File

@ -23,7 +23,7 @@ export default class ComponentDoc extends React.Component {
utils.setTitle(`${chinese} ${english} - Ant Design`);
}
handleExpandToggle() {
handleExpandToggle = () => {
this.setState({
expandAll: !this.state.expandAll,
});
@ -85,7 +85,7 @@ export default class ComponentDoc extends React.Component {
<h2>
代码演示
<Icon type="appstore" className={expandTriggerClass}
title="展开全部代码" onClick={this.handleExpandToggle.bind(this)} />
title="展开全部代码" onClick={this.handleExpandToggle} />
</h2>
</section>
<Row>

View File

@ -20,7 +20,7 @@ export default class Demo extends React.Component {
});
}
handleCodeExapnd() {
handleCodeExapnd = () => {
this.setState({ codeExpand: !this.state.codeExpand });
}
@ -57,7 +57,7 @@ export default class Demo extends React.Component {
</div>
{ introChildren }
<span className="collapse anticon anticon-circle-o-right"
onClick={this.handleCodeExapnd.bind(this)}
onClick={this.handleCodeExapnd}
unselectable="none" />
</section>
<section className={`highlight-wrapper ${codeExpand ? 'highlight-wrapper-expand' : ''}`}

View File

@ -34,7 +34,7 @@ export default class Header extends React.Component {
});
}
handleMenuIconClick(e) {
handleMenuIconClick = (e) => {
e.stopPropagation();
e.nativeEvent.stopImmediatePropagation();
this.setState({
@ -42,11 +42,11 @@ export default class Header extends React.Component {
});
}
handleSearch(value) {
handleSearch = (value) => {
this.context.router.push({ pathname: value });
}
handleSelectFilter(value, option) {
handleSelectFilter = (value, option) => {
return option.props['data-label'].indexOf(value.toLowerCase()) > -1;
}
@ -79,7 +79,7 @@ export default class Header extends React.Component {
<Col lg={4} md={6} sm={7} xs={24}>
<Icon
className="nav-phone-icon"
onClick={this.handleMenuIconClick.bind(this)}
onClick={this.handleMenuIconClick}
type="menu" />
<Link to="/" id="logo">
<img src="https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg" />
@ -94,8 +94,8 @@ export default class Header extends React.Component {
searchPlaceholder="搜索组件..."
optionLabelProp="nothing"
optionFilterProp="data-label"
filterOption={this.handleSelectFilter.bind(this)}
onSelect={this.handleSearch.bind(this)}>
filterOption={this.handleSelectFilter}
onSelect={this.handleSearch}>
{options}
</Select>
</div>