mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 02:59:58 +08:00
fix: noImplicitAny of back top (#6835)
This commit is contained in:
parent
2413c6af61
commit
96722605fd
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user