feat(Overlay): add lock-scroll prop (#6082)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// Utils
|
||||
import { createNamespace, isDef } from '../utils';
|
||||
import { createNamespace, isDef, noop } from '../utils';
|
||||
import { inherit } from '../utils/functional';
|
||||
import { preventDefault } from '../utils/dom/event';
|
||||
|
||||
@@ -12,6 +12,7 @@ export type OverlayProps = {
|
||||
zIndex?: number | string;
|
||||
duration: number | string | null;
|
||||
className?: any;
|
||||
lockScroll?: boolean;
|
||||
customStyle?: object;
|
||||
};
|
||||
|
||||
@@ -46,10 +47,10 @@ function Overlay(
|
||||
vShow={props.show}
|
||||
style={style}
|
||||
class={[bem(), props.className]}
|
||||
onTouchmove={preventTouchMove}
|
||||
onTouchmove={props.lockScroll ? preventTouchMove : noop}
|
||||
{...inherit(ctx, true)}
|
||||
>
|
||||
{slots.default && slots.default()}
|
||||
{slots.default?.()}
|
||||
</div>
|
||||
</transition>
|
||||
);
|
||||
@@ -61,6 +62,10 @@ Overlay.props = {
|
||||
duration: [Number, String],
|
||||
className: null as any,
|
||||
customStyle: Object,
|
||||
lockScroll: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
},
|
||||
};
|
||||
|
||||
export default createComponent<OverlayProps, OverlayEvents>(Overlay);
|
||||
|
||||
Reference in New Issue
Block a user