欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

微信小程序MUI側(cè)滑導(dǎo)航菜單示例(Popup彈出式,左側(cè)不動,右側(cè)滑動)

 更新時間:2019年01月23日 09:46:48   作者:Rattenking  
這篇文章主要介紹了微信小程序MUI側(cè)滑導(dǎo)航菜單,結(jié)合實例形式分析了微信小程序Popup彈出式,左側(cè)不動,右側(cè)滑動菜單相關(guān)實現(xiàn)技巧與注意事項,需要的朋友可以參考下

本文實例講述了微信小程序MUI側(cè)滑導(dǎo)航菜單。分享給大家供大家參考,具體如下:

實現(xiàn)的目標(biāo)—-YDUI的Popup組件

點擊列表圖標(biāo)—-左側(cè)的菜單欄顯示—-點擊關(guān)閉按鈕或者右側(cè)的遮罩層—-左側(cè)菜單欄關(guān)閉

實現(xiàn)方案1:左側(cè)菜單和右側(cè)展示頁面分為上下兩層

wxml

<view class="page">
  <----下層左側(cè)導(dǎo)航--->
  <view class="page-bottom">
    <view class="page-content">
      <view bindtap="open_list" wx:for-items="{{nav_list}}" class="page-list">
        <text>{{item}}</text>
      </view>
    </view>
  </view>
  <----上層右側(cè)展示頁面--->
  <view class="page-top {{open ? 'page-state' : ''}}">
  <----上層右側(cè)展示頁面遮罩層--->
   <view class="page-mask {{open ? '' : 'page-mask-show'}}" bindtap="offCanvas"></view>
   <----列表按鈕--->
    <image class="left-nav" bindtap="offCanvas" src="../../images/btn.png"></image>
     <----輪播代碼,可以不要--->
     <scroll-view scroll-y="true" style="height:200px" class="page-body" bindscrolltolower="loadMore">
     <view class="swiper">
      <swiper class="swiper-box" indicator-dots="{{indicatorDots}}" vertical="{{vertical}}"
          autoplay="{{autoplay}}" interval="{{interval}}" duration="{{duration}}"
          indicator-color="#fff" indicator-active-color="red">
        <block wx:for-items="{{banner_url}}" wx:key="item.id">
          <navigator url="../blogList/blogList">
           <swiper-item>
            <block wx:if="{{item}}">
             <image class="imgw" src="{{item.url}}" mode="aspectFill"/>
            </block>
            <block wx:else>
             <image src="../../images/default_pic.png" mode="aspectFill"></image>
            </block>
           </swiper-item>
          </navigator>
        </block>
      </swiper>
     </view>
    </scroll-view>
  </view>
</view>

wxss

page,.page {
 height: 100%;
 font-family: 'PingFang SC', 'Helvetica Neue', Helvetica, 'Droid Sans Fallback', 'Microsoft Yahei', sans-serif;
}
/*左側(cè)導(dǎo)航列表 */
.page-bottom{
 height: 100%;
 width: 75%;
 position: fixed;
 background-color: rgb(0, 68, 97);
 z-index: 0;
}
.page-list{
 color: white;
 padding: 30rpx 0 30rpx 40rpx;
}
/*右側(cè)展示層 */
.page-top{
 position: relative;
 top: 0;
 left:0;
 width: 750rpx;
 height: 100%;
 background-color: rgb(57, 125, 230);
 z-index: 0;
 transition: All 0.4s ease;
 -webkit-transition: All 0.4s ease;
}
.page-state{
 transform: rotate(0deg) scale(1) translate(75%,0%);
 -webkit-transform: rotate(0deg) scale(1) translate(75%,0%);
}
.imgw{width:100%;}
/*右側(cè)列表按鈕 */
.page-top .left-nav{
 position: fixed;
 width: 68rpx;
 height: 38rpx;
 left: 20rpx;
 bottom: 20rpx;
}
/*右側(cè)遮罩層 */
.page-mask{
 position: absolute;
 width: 100%;
 height: 100%;
 top: 0;
 left: 0;
 background-color: rgba(0,0,0,0.5);
 z-index: 998;
}
.page-mask-show{
 display: none;
}

js

var app = getApp();
var data = require('../../utils/data.js');
Page({
 /**
  * 頁面的初始數(shù)據(jù)
  */
 data: {
  banner_url: data.bannerList(),
  nav_list: ['ES6學(xué)習(xí)之路', 'CSS特效', 'VUE實戰(zhàn)','微信小程序'],
  open: false,
  indicatorDots: true,//是否顯示面板指示點
  autoplay: true,//是否開啟自動切換
  interval: 3000,//自動切換時間間隔
  duration: 500//滑動動畫時長
 },
 //列表的操作函數(shù)
 open_list: function(){
  //此處進(jìn)行操作
  this.setData({
   open: false
  });
 },
 //左側(cè)導(dǎo)航的開關(guān)函數(shù)
 offCanvas: function(){
  if(this.data.open){
   this.setData({
    open: false
   });
  }else{
   this.setData({
    open: true
   });
  }
 }
})

總結(jié):

1. 右側(cè)展示的動畫,我們可以直接通過class將其統(tǒng)一定義完整,然后通過切換class來改變動畫的控制—-減少了js對dom中style的操作。
2. 在左側(cè)菜單導(dǎo)航操作的最后記得open=false,使頁面還原。

DEMO源碼

點擊此處本站下載。

希望本文所述對大家微信小程序開發(fā)有所幫助。

相關(guān)文章

最新評論