国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 課堂 > 小程序 > 正文

微信小程序?qū)崿F(xiàn)單列下拉菜單效果

2020-03-21 15:59:21
字體:
供稿:網(wǎng)友

接下來我想做的是一個下拉菜單用來分類的,但是在網(wǎng)上搜了一下,基本上全都是比較復(fù)雜的分類菜單,最簡單的也是分三列的下拉菜單,但是并不想要這么復(fù)雜的,最后找了一個三列的,改成了單列。也把代碼盡可能的簡單化了。

實現(xiàn)的效果圖:

合并狀態(tài):

微信小程序,下拉菜單

首先下面是目錄結(jié)構(gòu): 

微信小程序,下拉菜單

下面是實現(xiàn)的具體代碼:

.wxml

<!--選擇框--><view class="product-list"> <!--條件選擇--> <view class="choice-bar">  <view bindtap="opens" data-item="1" class="chioce-item" hover-class="click-once-opaque">{{start}}   <image class="icon-chioce" src="{{!isstart?openimg: offimg}}"></image>  </view>  <view class="sorting-list{{!isstart?' chioce-list-hide':' chioce-list-show'}}">   <view wx:for="{{slist}}" catchtap="onclicks1" data-index="{{index}}" class="sorting-item" hover-class="click-once" wx:key="userInfoListId" >{{item.name}}</view>  </view> </view></view>

.wxss

.product-list { width: 100%; box-sizing: border-box; }  .choice-bar { position: fixed; display: flex; width: 100%; font-size: 14px; background-color: #fff; /**z-index: 0;**/}.chioce-item { background-color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 20rpx; width: 100%; height: 80rpx; border-top: 1rpx solid #ddd; border-bottom: 1rpx solid #ddd; border-left: 1rpx solid #ddd; /*border-right: 1rpx solid #ddd;*/} .icon-chioce { height: 30rpx; width: 30rpx;}.district-list,.sorting-list,.filter-list { margin-top: 2rpx; position: absolute; top: 80rpx; left: 0; width: 100%; background-color: #fff; z-index: -1; font-size: 14px; border-bottom: 1rpx solid #ddd;}.chioce-list-hide { display: none !important;}.chioce-list-show { /**top: 80rpx;**/ animation: slide 500ms;} .sorting-item { height: 80rpx; line-height: 80rpx; padding: 0 40rpx; border-bottom: 1rpx solid #ddd;}

.js

Page({ data: {  start: "起始地",  slist: [   { id: 1, name: "第一類" },   { id: 1, name: "第二類" },   { id: 1, name: "第三類" },   { id: 1, name: "第四類" },   { id: 1, name: "第五類" },  ],  isstart: false,  openimg: "/images/list/list.png",  offimg: "/images/list/list1.png" }, opens: function (e) {  switch (e.currentTarget.dataset.item) {   case "1":    if (this.data.isstart) {     this.setData({      isstart: false,     });    }    else {     this.setData({      isstart: true,     });    }    break;  } }, onclicks1: function (e) {  var index = e.currentTarget.dataset.index;  let name = this.data.slist[index].name;  this.setData({   isstart: false,   isfinish: false,   isdates: false,   start: this.data.slist[index].name,   finish: "目的地"  }) }})

以上所述是小編給大家介紹的微信小程序單列下拉菜單詳解整合,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對VEVB武林網(wǎng)網(wǎng)站的支持!


發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 西青区| 鹤壁市| 时尚| 黄大仙区| 龙井市| 泗阳县| 渭源县| 门源| 蓝山县| 白城市| 宣威市| 保山市| 榆树市| 木兰县| 元朗区| 灌云县| 汕尾市| 定西市| 四平市| 航空| 易门县| 仁寿县| 当涂县| 马山县| 尉氏县| 普洱| 中方县| 新龙县| 云龙县| 微博| 南召县| 观塘区| 富锦市| 吉隆县| 长岛县| 马鞍山市| 灵寿县| 余姚市| 乌海市| 柘城县| 定安县|