Skip to content

Commit

Permalink
fix(scrollbar): 修改问题 (#3019)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanjinping committed Nov 5, 2024
1 parent 1f7330f commit fc1c108
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
7 changes: 4 additions & 3 deletions packages/ui/scrollbar/src/Scrollbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ScrollbarEventProps,
ScrollbarPositionEnum,
ScrollbarHelpers,
Settings,
} from './types'
import { ScrollbarEventToPsMap } from './utils'

Expand All @@ -28,7 +29,7 @@ export const Scrollbar = forwardRef<HTMLDivElement | null, ScrollbarProps>(
style,
zIndex,
innerRef,
settings,
settings = {},
...rest
},
ref
Expand Down Expand Up @@ -177,10 +178,10 @@ export interface ScrollbarProps extends HiBaseHTMLProps<'div'>, ScrollbarEventPr
*/
onlyScrollVisible?: boolean
/**
* 原生滚动条配置
* 滚动条配置
* @default {}
*/
settings: Record<string, string | number | boolean>
settings: Settings
}

if (__DEV__) {
Expand Down
14 changes: 14 additions & 0 deletions packages/ui/scrollbar/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,17 @@ export type ScrollbarPositionEnum =
| 'fixed'
| 'relative'
| 'sticky'

/**
* 更多配置请参考:https://perfectscrollbar.com/
*/
export type Settings = PerfectScrollbar.Options & {
/**
* 开启滚动条吸底
*/
isBottomToScreenBottom?: boolean
/**
* 滚动条吸底距离
*/
heightFromBottom?: number
}
4 changes: 2 additions & 2 deletions packages/ui/scrollbar/stories/fixed.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React, { useRef, useEffect } from 'react'
import Scrollbar from '../src'

/**
* @title 使能坐标轴
* @desc 默认 `x`、`y` 都可滚动
* @title 滚动条固定到屏幕底部
* @desc 默认不开启
*/
export const Fixed = () => {
const innerRef = useRef<any>()
Expand Down

0 comments on commit fc1c108

Please sign in to comment.