Browse Source

lint fix

pull/3853/head
RaoHai 8 years ago
parent
commit
146f3180aa
  1. 8
      components/anchor/AnchorLink.tsx
  2. 4
      components/anchor/anchorHelper.tsx
  3. 2
      components/anchor/index.tsx

8
components/anchor/AnchorLink.tsx

@ -4,7 +4,7 @@ import AnchorHelper, { scrollTo } from './anchorHelper';
export interface AnchorLinkProps {
href: string;
onClick: (href: string) => void;
onClick: (href: string, component: Element) => void;
active?: boolean;
prefixCls?: string;
children?: any;
@ -28,12 +28,12 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
prefixCls: 'ant-anchor',
};
private _component: Element;
context: {
anchorHelper: AnchorHelper;
};
private _component: Element;
constructor(props, context) {
super(props, context);
}
@ -42,7 +42,7 @@ export default class AnchorLink extends React.Component<AnchorLinkProps, any> {
return {
anchorHelper: this.context.anchorHelper,
};
}
}
setActiveAnchor() {
const { bounds, href, affix } = this.props;

4
components/anchor/anchorHelper.tsx

@ -37,7 +37,7 @@ export function getOffsetTop(element): number {
return rect.top;
}
export function scrollTo(href, target = getDefaultTarget, callback) {
export function scrollTo(href, target = getDefaultTarget, callback = () => {}) {
const scrollTop = getScroll(target(), true);
const targetElement = document.getElementById(href.substring(1));
if (!targetElement) {
@ -57,7 +57,7 @@ export function scrollTo(href, target = getDefaultTarget, callback) {
}
};
reqAnimFrame(frameFunc);
history.pushState(null, undefined, href);
history.pushState(null, '', href);
}
class AnchorHelper {

2
components/anchor/index.tsx

@ -91,7 +91,7 @@ export default class Anchor extends React.Component<AnchorProps, any> {
this._avoidInk = false;
});
}
renderAnchorLink = (child) => {
const { href } = child.props;
if (href) {

Loading…
Cancel
Save