找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 小程序开发 查看内容

michael:微信小程序之自定义模态弹窗(带动画)实例

作者:模板之家 2017-12-6 16:57 3607人关注

首先看看官方提供的模态弹窗 api 如下: 示例: 这样的模态弹窗,充其量只能做个alert,提示一下信息。 但是并不能使用它来处理复杂性的弹窗业务,因此写了Michael从新自定义了一个

首先看看官方提供的模态弹窗

 

api如下:


 

示例:


这样的模态弹窗,充其量只能做个alert,提示一下信息。

但是并不能使用它来处理复杂性的弹窗业务,因此写了Michael从新自定义了一个,采用了仿原生的样式写法

 

 

wxml

 

[html] view plain copy
 
  1. <!--button-->  
  2. <view class="btn" bindtap="powerDrawer" data-statu="open">button</view>  
  3.   
  4. <!--mask-->  
  5. <view class="drawer_screen" bindtap="powerDrawer" data-statu="close" wx:if="{{showModalStatus}}"></view>  
  6. <!--content-->  
  7. <!--使用animation属性指定需要执行的动画-->  
  8. <view animation="{{animationData}}" class="drawer_box" wx:if="{{showModalStatus}}">  
  9.   
  10.   <!--drawer content-->  
  11.   <view class="drawer_title">弹窗标题</view>  
  12.   <view class="drawer_content">  
  13.     <view class="top grid">  
  14.       <label class="title col-0">标题</label>  
  15.       <input class="input_base input_h30 col-1" name="rName" value="可自行定义内容"></input>  
  16.     </view>  
  17.     <view class="top grid">  
  18.       <label class="title col-0">标题</label>  
  19.       <input class="input_base input_h30 col-1" name="mobile" value="110"></input>  
  20.     </view>  
  21.     <view class="top grid">  
  22.       <label class="title col-0">标题</label>  
  23.       <input class="input_base input_h30 col-1" name="phone" value="拒绝伸手党"></input>  
  24.     </view>  
  25.     <view class="top grid">  
  26.       <label class="title col-0">标题</label>  
  27.       <input class="input_base input_h30 col-1" name="Email" value="仅供学习使用"></input>  
  28.     </view>  
  29.     <view class="top bottom grid">  
  30.       <label class="title col-0">备注</label>  
  31.       <input class="input_base input_h30 col-1" name="bz"></input>  
  32.     </view>  
  33.   </view>  
  34.   <view class="btn_ok" bindtap="powerDrawer" data-statu="close">确定</view>  
  35. </view>

路过

雷人

握手

鲜花

鸡蛋
原作者: 模板之家 来自: 网络收集

全部回复(0)