useScrollLock

用户处理页面是否能滚动
Import
import { useScrollLock } from '@kubed/hooks;'
Source
View source code
Docs
Edit this page
npm
@kubed/hooks

用法

useScrollLock 请点击按钮查看效果

API

useScrollLock 钩子接受一个参数:

  • lock – 是否锁定
1
function useScrollLock(
2
lock?: boolean
3
): readonly [boolean, React.Dispatch<React.SetStateAction<boolean>>]

Params

参数默认值类型描述
lockfalseboolean页面是否锁定滚动

Result

参数默认值类型描述
scrollLocked-boolean是否锁定状态
setScrollLocked-React.Dispatch<React.SetStateAction<boolean>>设置当前状态