mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
style: update code style for Anchor
This commit is contained in:
parent
db035aa691
commit
c94f577416
@ -19,10 +19,6 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||||
anchorHelper: React.PropTypes.any,
|
||||
};
|
||||
|
||||
static childContextTypes = {
|
||||
anchorHelper: React.PropTypes.any,
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
href: '#',
|
||||
prefixCls: 'ant-anchor',
|
||||
@ -34,12 +30,6 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||||
|
||||
private _component: Element;
|
||||
|
||||
getChildContext() {
|
||||
return {
|
||||
anchorHelper: this.context.anchorHelper,
|
||||
};
|
||||
}
|
||||
|
||||
setActiveAnchor() {
|
||||
const { bounds, href, affix } = this.props;
|
||||
const { anchorHelper } = this.context;
|
||||
@ -75,9 +65,9 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
|
||||
}
|
||||
|
||||
scrollTo = (e) => {
|
||||
e.preventDefault();
|
||||
const { onClick, href } = this.props;
|
||||
const { anchorHelper } = this.context;
|
||||
e.preventDefault();
|
||||
if (onClick) {
|
||||
onClick(href, this._component);
|
||||
} else {
|
||||
|
@ -136,7 +136,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
|
||||
</div>
|
||||
);
|
||||
|
||||
return affix === false ? anchorContent : (
|
||||
return !affix ? anchorContent : (
|
||||
<Affix offsetTop={offsetTop}>
|
||||
{anchorContent}
|
||||
</Affix>
|
||||
|
Loading…
Reference in New Issue
Block a user