UNPKG

antd-mobile-taro-ui

Version:

以antd-mobile为设计标准,基于taro框架的微信小程序组件库

36 lines (29 loc) 743 B
import Taro from '@tarojs/taro'; import { isH5 } from './client'; const BODY_LOCK_STYLE = { overflow: 'hidden', height: '100vh' }; const BODY_UNLOCK_STYLE = { overflow: 'visible', height: 'auto' }; export function useLockScroll(shouldLock) { var _a, _b; if (isH5) return; if (!shouldLock) { (_a = Taro === null || Taro === void 0 ? void 0 : Taro.setPageStyle) === null || _a === void 0 ? void 0 : _a.call(Taro, { style: BODY_UNLOCK_STYLE, fail(e) { console.log(e); } }); return; } (_b = Taro === null || Taro === void 0 ? void 0 : Taro.setPageStyle) === null || _b === void 0 ? void 0 : _b.call(Taro, { style: BODY_LOCK_STYLE, fail(e) { console.log(e); } }); }