@@ -15,19 +15,21 @@ import {
1515import { ITouchEvent , View } from '@tarojs/components'
1616import classNames from 'classnames'
1717import { Top } from '@nutui/icons-react-taro'
18- import { BasicComponent , ComponentDefaults } from '@/utils/typings'
19- import HoverButton from '@/packages/hoverbutton/index.taro'
20- import { harmonyAndRn , rn } from '@/utils/platform-taro'
18+ import { ComponentDefaults } from '@/utils/typings'
19+ import HoverButton , {
20+ HoverButtonProps ,
21+ } from '@/packages/hoverbutton/index.taro'
22+ import { rn } from '@/utils/platform-taro'
2123
22- export interface BackTopProps extends BasicComponent {
24+ export interface BackTopProps extends HoverButtonProps {
2325 threshold : number
2426 zIndex : number
2527 duration : number
2628 /**
2729 * 容器滚动时的回调参数,主要用于 rn、鸿蒙端
2830 */
2931 scrollRes ?: PageScrollObject
30- onClick ?: ( event : React . MouseEvent < Element , MouseEvent > | ITouchEvent ) => void
32+ // onClick?: (event: React.MouseEvent<Element, MouseEvent> | ITouchEvent) => void
3133}
3234
3335const defaultProps = {
@@ -37,8 +39,6 @@ const defaultProps = {
3739 duration : 1000 ,
3840} as BackTopProps
3941
40- const isNative = harmonyAndRn ( )
41-
4242export const BackTop : FunctionComponent <
4343 Partial < BackTopProps > & Omit < React . HTMLAttributes < HTMLDivElement > , 'onClick' >
4444> = ( props ) => {
@@ -48,6 +48,7 @@ export const BackTop: FunctionComponent<
4848 zIndex,
4949 className,
5050 duration,
51+ icon,
5152 style,
5253 scrollRes,
5354 onClick,
@@ -104,7 +105,7 @@ export const BackTop: FunctionComponent<
104105 < HoverButton
105106 className = { cls }
106107 style = { { zIndex, ...style } }
107- icon = { ! children && < Top /> }
108+ icon = { ! children && ( icon || < Top /> ) }
108109 onClick = { ( e ) => {
109110 goTop ( e )
110111 } }
0 commit comments