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