找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

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

微信小程序之自定义抽屉菜单(从下拉出)实例

作者:模板之家 2017-12-5 09:04 1871人关注

微信提供了动画api,就是下面这个相关链接:https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-animation.html#wxcreateanimationobject通过使用这个创建动画的api,可以做出很 ... 微信提供了动画api ,就是下

微信提供了动画api,就是下面这个相关链接:https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-animation.html#wxcreateanimationobject通过使用这个创建动画的api,可以做出很 ...

 
 
 

微信提供了动画api,就是下面这个

 

相关链接:https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-animation.html#wxcreateanimationobject

 

通过使用这个创建动画的api,可以做出很多特效出来

下面介绍一个抽屉菜单的案例

 

实现代码:

wxml:

 

[html] view plain copy
 
  1. <!--button-->  
  2. <view class="btn" bindtap="powerDrawer" data-statu="open">button</view>  
  3. <!--mask-->  
  4. <view class="drawer_screen" bindtap="powerDrawer" data-statu="close" wx:if="{{showModalStatus}}"></view>  
  5. <!--content-->  
  6. <!--使用animation属性指定需要执行的动画-->  
  7. <view animation="{{animationData}}" class="drawer_attr_box" wx:if="{{showModalStatus}}">  
  8.   <!--drawer content-->  
  9.   <view class="drawer_content">  
  10.     <view class="drawer_title line">菜单1</view>  
  11.     <view class="drawer_title line">菜单2</view>  
  12.     <view class="drawer_title line">菜单3</view>  
  13.     <view class="drawer_title line">菜单4</view>  
  14.     <view class="drawer_title">菜单5</view>  
  15.   </view>  
  16. </view>  

 

 

 

wxss

[css] view plain copy
 
  1. /*button*/  
  2. .btn {  
  3.   width80%;  
  4.   padding20rpx 0;  
  5.   border-radius: 10rpx;  
  6.   text-aligncenter;  
  7.   margin40rpx 10%;  
  8.   background#0C1939;  
  9.   color#fff;  
  10. }  
  11. /*mask*/  
  12. .drawer_screen {  
  13.   width100%;  
  14.   height100%;  
  15.   positionfixed;  
  16.   top: 0;  
  17.   left: 0;  
  18.   z-index1000;  
  19.   background#000;  
  20.   opacity: 0.2;  
  21.   overflowhidden;  
  22. }  
  23. /*content*/  
  24. .drawer_attr_box {  
  25.   width100%;  
  26.   overflowhidden;  
  27.   positionfixed;  
  28.   bottom: 0;  
  29.   left: 0;  
  30.   z-index1001;  
  31.   background#fff;  
  32. }  
  33. .drawer_content {  
  34. 邀请

路过

雷人

握手

鲜花

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

全部回复(0)