mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-18 19:28:05 +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 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) {
|
||||||
@ -19,7 +19,7 @@ const easeInOutCubic = (t, b, c, d) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function noop() {}
|
function noop() { }
|
||||||
|
|
||||||
function getDefaultTarget() {
|
function getDefaultTarget() {
|
||||||
return typeof window !== 'undefined' ?
|
return typeof window !== 'undefined' ?
|
||||||
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user