0.0.20 • Published 4 years ago

@retailwe/ui-popup v0.0.20

Weekly downloads
-
License
-
Repository
-
Last release
4 years ago

wr-popup 弹窗效果

引入

全局引入,在 miniprogram 根目录下的app.json中配置,局部引入,在需要引入的页面或组件的index.json中配置。

// app.json 或 index.json
"usingComponents": {
  "wr-popup": "@retailwe/ui-popup/index"
}

代码演示

基础用法

通用弹窗组件 通过position控制弹出方向,并通过 slot 控制显示的内容和自定义关闭按钮

注意: 如要使用wx:if移除节点并希望显示退出动画,父组件应该在closeover事件触发后再进行移除

<wr-popup show="{{show2}}" position="bottom" bindclose="close">
  <view class="con" slot="content">show2</view>
</wr-popup>
Page({
  data: {
    show1: false,
    show2: false,
  },
  handleClose() {},
  close() {},
  handleTap(e) {
    const { index } = e.currentTarget.dataset;
    if (index == 1) {
      this.setData({
        show1: true,
      });
    } else {
      this.setData({
        show2: true,
      });
    }
  },
});

API

wr-popup Props

参数说明类型默认值版本
show弹窗显示状态booleanfalse-
fixed弹窗定位方式是否为绝对定位booleantrue-
transition弹窗动画类型string--
duration弹窗动画时间object | number{ enter: 300, leave: 200 }-
timingFunction动画进入类型stringease-
maskColor蒙层背景颜色stringrgba(0,0,0,0.5)-
maskStyle蒙层样式string--
contentStylecontent容器样式string--
bottomSafeAreaStyle底部安全区域样式string--
forbideScroll是否禁止滑动booleanfalse-
forbidBgScroll是否禁止背景滑动booleanfalse-
position弹窗弹出位置(center,left,right,top,bottom)stringcenter-
zIndex当前弹窗所在的层级值number2001-
mask是否显示遮罩层booleantrue-
maskClosable点击遮罩层是否能够关闭弹窗booleantrue-
isIcon是否显示自定义关闭按钮booleanfalse-
destroyOnClose关闭弹框时是否移除内部节点booleantrue-
catchTouchMove是否捕获滚动事件booleantrue-

wr-popup Event

事件名说明参数
close用户点击关闭按钮或者遮罩层触发
closeover关闭动画结束后触发
openover打开动画结束后触发

wr-popup Slot

名称说明
content自定义内容显示部分
名称说明
close_icon自定义关闭按钮
0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.16

4 years ago

0.0.15

4 years ago

0.0.14

4 years ago

0.0.13

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7-beta.1

4 years ago