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

微信小程序?qū)崿F(xiàn)列表條件篩選

 更新時間:2022年07月17日 15:35:59   作者:shadow_yi8978  
這篇文章主要為大家詳細介紹了微信小程序?qū)崿F(xiàn)列表條件篩選,篩選框的效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了微信小程序?qū)崿F(xiàn)列表條件篩選的具體代碼,供大家參考,具體內(nèi)容如下

最近一個旅游項目,關(guān)于篩選框的代碼

wxml文件 

<view class='chooseList'>
? ? ? <view class="nav">
? ? <view class="nav-son {{shownavindex == 1? 'active' : ''}}" bindtap="listqy" data-nav="1">
? ? ? <view class="content">酒店類型</view>
? ? ? <view class="icon"></view>
? ? </view>
? ? <view class="nav-son borders {{shownavindex == 2? 'active' : ''}}" bindtap="list" data-nav="2">
? ? ? <view class="content">價格</view>
? ? ? <view class="icon"></view>
? ? </view>
? ? <!-- <view class="nav-son {{shownavindex == 3? 'active' : ''}}" bindtap="listpx" data-nav="3">
? ? ? <view class="content">排序</view>
? ? ? <view class="icon"></view>
? ? </view> -->
? </view>
?
? <view class="quyu {{qyopen ? 'slidown' : 'slidup'}} {{qyshow ? 'disappear':''}}">
?
? ? <view class="qy quyu-left">
? ? ? <view class="{{select1 == index ? 'current' : ''}}" wx:for="{{cityleft}}" wx:key='{{item}}' bindtap="selectleft" data-city='{{index}}'>
? ? ? ? {{index}}
? ? ? </view>
? ? </view>
? ? <view class="qy quyu-center">
? ? ? <view class="{{select2 == index ? 'current2' : ''}}" wx:for="{{citycenter}}" bindtap="selectcenter" data-value='{{item}}' data-city='{{index}}'>
? ? ? ? {{index}}
? ? ? ? <image src='../../images/istrue.png' style="{{select2 == index?'display:block':'display:none'}}"></image>
? ? ? </view>
? ? ? ? ? ? <!-- 如果選擇是早餐,展示篩選按鈕 -->
? ? ? ? ? ? <view style="border-style: none;" wx:if='{{isshowradio}}'>
? ? ? ? ? ? ? ? <radio-group class="radio-group" bindchange="radioChange">
? ? ? ? ? ? ? ? ? ? <label class="radio" wx:for="{{breakfastlist}}">
? ? ? ? ? ? ? ? ? ? ? ? <radio value="{{item.value}}" checked="{{item.checked}}" />
? ? ? ? ? ? ? ? ? ? ? ? {{item.value}}
? ? ? ? ? ? ? ? ? ? </label>
? ? ? ? ? ? ? ? </radio-group>
? ? ? ? ? ? </view>
? ? </view>
? ? <view class='form-btn'>
? ? ? <button class='btn-reset' bindtap='quyuEmpty'>重置</button>
? ? ? <button class='btn-submit' bindtap='submitFilter'>確定</button>
? ? </view>
? </view>

js文件:

點擊酒店類型,展示篩選酒店的條件

listqy: function (e) {
? ? ? ? console.log('觸發(fā)時機---點擊酒店類型的時候')
? ? if (this.data.qyopen) {
? ? ? ? ? ? console.log(this.data.qyopen)
? ? ? this.setData({
? ? ? ? qyopen: false,
? ? ? ? nzopen: false,
? ? ? ? nzshow: true,
? ? ? ? qyshow: false,
? ? ? ? isfull: false,
? ? ? ? shownavindex: 0
? ? ? })
? ? } else {
? ? ? this.setData({
? ? ? ? qyopen: true,
? ? ? ? nzopen: false,
? ? ? ? nzshow: true,
? ? ? ? qyshow: false,
? ? ? ? isfull: true,
? ? ? ? shownavindex: e.currentTarget.dataset.nav
? ? ? })
? ? }
? },

點擊一級菜單,展示對應(yīng)的二級菜單

selectleft: function (e) {
? ? console.log('用戶選中左邊菜單欄的索引值是:' + e.target.dataset.city);
? ? ? ? if (e.target.dataset.city === '床型、早餐') {
? ? ? ? ? ? console.log('哈哈')
? ? ? ? ? ? this.setData({
? ? ? ? ? ? ? ? isshowradio: true // 如果是早餐和床型的話,就讓選擇早餐的按鈕顯示
? ? ? ? ? ? })
? ? ? ? } else {
? ? ? ? ? ? this.setData({
? ? ? ? ? ? ? ? isshowradio: false
? ? ? ? ? ? })
? ? ? ? }
? ? this.setData({
? ? ? citycenter: this.data.cityleft[e.currentTarget.dataset.city],
? ? ? select1: e.target.dataset.city,
? ? ? select2: ''
? ? });
? },

點擊二級菜單 

selectcenter: function (e) {
? ? ? ? console.log(e.target.dataset.value)
? ? ? ? console.log('用戶選中右邊邊菜單欄的索引值是:' + e.target.dataset.value, this.data.select1);
? ? ? ? let _this = this
? ? ? ? if (_this.data.select1 === '酒店類型') {
? ? ? ? ? ? _this.data.type = e.target.dataset.city
? ? ? ? ? ? console.log(_this.data.type)
? ? ? ? }
? ? ? ? if (_this.data.select1 === '設(shè)施') {
? ? ? ? ? ? _this.data.facility = e.target.dataset.city
? ? ? ? ? ? console.log(_this.data.facility)
? ? ? ? }
? ? ? ? if (_this.data.select1 === '地理位置') {
? ? ? ? ? ? _this.data.maxdistance = e.target.dataset.value
? ? ? ? ? ? console.log(_this.data.maxdistance)
? ? ? ? }
? ? ? ? if (_this.data.select1 === '床型、早餐') {
? ? ? ? ? ? _this.data.cbedtype = e.target.dataset.city
? ? ? ? ? ? console.log(_this.data.cbedtype)
? ? ? ? }
? ? this.setData({
? ? ? select2: e.target.dataset.city
? ? });
? },

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論