0.0.23 • Published 3 years ago

@retailwe/ui-dialog v0.0.23

Weekly downloads
17
License
-
Repository
-
Last release
3 years ago

Dialog 弹出框

引入

"usingComponents": {
  "wr-dialog": "@retailwe/ui-dialog/index"
}

代码演示

基础用法

用于提示一些消息,只包含一个确认按钮

<wr-dialog
  show="{{show3}}"
  message="{{message}}"
  bindconfirm="confirm"
  showCancelButton="{{showCancelButton}}"
>
</wr-dialog>
Page({
  data: {
    show1: false,
    show2: false,
    show3: false,
    show7: false,
    show6: false,
    title: '标题',
    message: '弹框内容message',
    showCancelButton: true,
  },
  handleTap(e) {
    const { index } = e.currentTarget.dataset;
    if (index == 5) {
      Dialog.confirm({
        title: '标题',
        message: '编程式调用可以方便的回调~',
      })
        .then(() => {
          Toast({
            icon: 'success',
            text: '回调: 确定',
          });
        })
        .catch(() => {
          Toast({
            text: '回调: 取消',
          });
        });
    } else {
      this.setData({
        ['show' + index]: true,
      });
    }
  },
  dailogClose() {
    this.setData({
      show6: false,
    });
  },
});

API

Props

通过组件调用 Dialog 时,支持以下 Props:

参数说明类型默认值
show是否显示弹窗boolean-
title标题string-
message文本内容,支持通过\n换行string-
textAlignmessage 的文本对齐方式'center'|'left'|'right''center'
z-indexz-index 层级number100
showConfirmButton是否展示确认按钮booleantrue
showCancelButton是否展示取消按钮booleanfalse
confirmButtonText确认按钮的文案string确认
cancelButtonText取消按钮的文案string取消
confirmOpenTypeValue确认按钮微信开放能力,可参考微信文档string
asyncClose是否支持异步关闭弹窗,开启后需要手动关闭弹窗booleanfalse
direction按钮排列方式_'row'|'column''row'
actions按钮列表array-
// `actions` props:
interface Action {
  name: string; // 按钮文案
  primary?: boolean; // 是否主要按钮(颜色与其他按钮不同)
  style?: string; // 自定义样式
}

Events

事件说明回调参数
bindconfirm点击确认按钮时触发-
bindcancel点击取消按钮时触发-
0.0.23

3 years ago

0.0.22

3 years ago

0.0.21

4 years ago

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