fix: noImplicitAny of back top (#6835)

This commit is contained in:
陈帅 2017-07-14 15:37:44 +08:00 committed by Benjy Cui
parent 2413c6af61
commit 96722605fd

View File

@ -9,7 +9,7 @@ import getRequestAnimationFrame from '../_util/getRequestAnimationFrame';
const reqAnimFrame = getRequestAnimationFrame();
const easeInOutCubic = (t, b, c, d) => {
const easeInOutCubic = (t: number, b: number, c: number, d: number) => {
const cc = c - b;
t /= d / 2;
if (t < 1) {
@ -19,7 +19,7 @@ const easeInOutCubic = (t, b, c, d) => {
}
};
function noop() {}
function noop() { }
function getDefaultTarget() {
return typeof window !== 'undefined' ?
@ -42,7 +42,7 @@ export default class BackTop extends React.Component<BackTopProps, any> {
scrollEvent: any;
constructor(props) {
constructor(props: BackTopProps) {
super(props);
this.state = {
visible: false,
@ -57,7 +57,7 @@ export default class BackTop extends React.Component<BackTopProps, any> {
return (targetNode as HTMLElement).scrollTop;
}
scrollToTop = (e) => {
scrollToTop = (e: React.MouseEvent<HTMLDivElement>) => {
const scrollTop = this.getCurrentScrollTop();
const startTime = Date.now();
const frameFunc = () => {
@ -72,7 +72,7 @@ export default class BackTop extends React.Component<BackTopProps, any> {
(this.props.onClick || noop)(e);
}
setScrollTop(value) {
setScrollTop(value: number) {
const targetNode = (this.props.target || getDefaultTarget)();
if (targetNode === window) {
document.body.scrollTop = value;