跳到主要内容

overlay

overlay.ts

overlayProps

  • mask: default: true
  • customMaskEvent: default: false
  • overlayClass
  • zIndex

overlayEmits

  • click

component setup

    return () => {
// when the vnode meets the same structure but with different change trigger
// it will not automatically update, thus we simply use h function to manage updating
return props.mask
? createVNode(
'div',
{
class: [ns.b(), props.overlayClass],
style: {
zIndex: props.zIndex,
},
onClick,
onMousedown,
onMouseup,
},
[renderSlot(slots, 'default')],
PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS,
['onClick', 'onMouseup', 'onMousedown']
)
: h(
'div',
{
class: props.overlayClass,
style: {
zIndex: props.zIndex,
position: 'fixed',
top: '0px',
right: '0px',
bottom: '0px',
left: '0px',
} as CSSProperties,
},
[renderSlot(slots, 'default')]
)
}

css

@include b(overlay) {
#{& + '-root'} {
height: 0;
}
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 2000;
height: 100%;
background-color: getCssVar('overlay-color', 'lighter');
overflow: auto;
}