Popup

Popup window.

Attribute NameDescriptionTypeDefaultMandatory
classNameCustom classStringfalse
showShow menu or notBooleanfalsefalse
animationEnable animation or notBooleantruefalse
maskShow mask or not. Clicking outside does not trigger onClose when it is not shown.Booleantruetrue
positionControl the direction in which the menu pops up. Bottom indicating the bottom side, left the left side, top the top side and right the right side.Stringbottomfalse
disableScrollDisable page scroll or not when mask   is shownBooleantruefalse
zIndexDefine the number of popup levelsNumber0false

Slots

It is possible to define the parts to be shown in the popup component. See the following example for details.

Example

copy
{
  "defaultTitle": "AntUI Component Library",
  "usingComponents": {
    "popup": "mini-antui/es/popup/index"
  }
}
copy
<view>
  <view class="btn-container">
    <button onTap="onTopBtnTap">Popup</button>
  </view>
  <popup show="{{showTop}}" position="top" onClose="onPopupClose">
    <view style="height: 200px; background: #fff; display: flex; justify-content: center; align-items: center;">hello world</view>
  </popup>
</view>
copy
Page({
  data: {
    showTop: false,
  },
  onTopBtnTap() {
    this.setData({
      showTop: true,
    });
  },
  onPopupClose() {
    this.setData({
      showTop: false,
    });
  },
});