1.0.2 • Published 5 years ago

wechat-miniprogram-dialog v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

wechat-miniprogram-dialog

预览图

特性

  • 仿官方弹窗样式
  • 支持调整模态透明度
  • 支持获取Formid
  • 支持打开微信开放能力功能

下载

git clone https://github.com/simsir-lin/wechat-miniprogram-dialog.git

DEMO

  1. 打开微信web开发者工具,'本地小程序项目 - 添加项目',项目目录选择为 miniprogram_dev 目录

使用

  1. 安装
npm install --save wechat-miniprogram-dialog
  1. 每次引入或更新需先执行开发者工具的 npm 构建,微信官方 npm 文档
  2. 在你的页面json中添加
{
  "usingComponents": {
    "dialog": "wechat-miniprogram-dialog"
  }
}
  1. 在wxml中即可使用组件
<dialog></dialog>

调试开发

  1. 打开微信web开发者工具,'本地小程序项目 - 添加项目',项目目录选择为 miniprogram_dev 目录
  2. 安装依赖 npm install
  3. 构建命令 npm run dev
  4. 更多帮助信息查看帮助文档

注意

  • 小程序基础库版本 2.2.1 或以上、及开发者工具 1.02.1808300 或以上开始

Props

namedescriptiontypedefault value
title标题String提示
width宽度String650rpx
opacity模态层的透明度Number0.4
closeOnClickModal是否可以通过点击模态层关闭弹窗Booleanfalse
animation开启动画Booleantrue
confirmText确定按钮的文字String确定
cancelText取消按钮的文字String取消
confirmColor确定按钮的文字颜色String#333333(支持RGBA)
cancelColor取消按钮的文字颜色String#999999(支持RGBA)
showConfirm是否显示确定按钮Booleantrue
showCancel是否显示取消按钮Booleantrue
confirmBackgroundColor确定按钮背景颜色String#ffffff(支持RGBA)
cancelBackgroundColor取消按钮背景颜色String#ffffff(支持RGBA)
confirmOpenType确定按钮微信开放能力,请参考https://developers.weixin.qq.com/miniprogram/dev/component/button.htmlString
cancelOpenType取消按钮微信开放能力,请参考https://developers.weixin.qq.com/miniprogram/dev/component/button.htmlString
loading确认按钮是否带 loading 图标Booleantrue
gatherFormId是否收集formIdBooleantrue
appParameter打开 APP 时,向 APP 传递的参数,*-open-type="launchApp"时有效String
sessionFrom会话来源,*-open-type="contact"时有效String
position位置,有center、top、bottomStringcenter

events

namedescriptionparameters
open当窗口打开
close当窗口关闭
cancel点击取消
confirm点击确认
getFormId获取到formidevent.detail.formId
getuserinfo点击按钮时,会返回获取到的用户信息,*-open-type="getUserInfo"时有效event.detail
contact客服消息回调,*-open-type="contact"时有效
getphonenumber获取用户手机号回调,*-open-type="getPhoneNumber"时有效event.detail
opensetting在打开授权设置页后回调,*-open-type="openSetting"时有效
launchapp打开 APP 成功的回调,*-open-type="launchApp"时有效

贡献

如果你有好的意见或建议,欢迎给我提issue!

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago