uniapp实现下拉过滤查询列表

 <picker bindchange="bindPickerChanges" value="{{selectedIndex}}"
                range="{{pickerArray}}"
                range-key="name">
          <view class="area-select">在线状态:
              <label for="">{{pickerArray[selectedIndex].name}}</label>
              <image src="/img/arrow_down.png"></image>
          </view>
        </picker>

page{
data{
 pickerArray: [{
      value: 0,
      name: '全部'
    },{
      value: 1,
      name: '在线'
    }, {
      value: 2,
      name: '离线'
    }],
    selectedIndex: 0,
	}
}
//点击事件
  bindPickerChanges: function(e) {
    this.setData({
      selectedIndex : e.detail.value,
      'query.netStatus': this.data.pickerArray[e.detail.value].value
    });
    this.onSearch();
  },

返回主页面时需要将下拉的name值进行匹配,重新刷新
下拉的状态值: ‘query.netStatus’

  onShow: function () {
    let pages = getCurrentPages();
    let currPage = pages[pages.length - 1]; //当前页面
    let districtName = currPage.data.districtName;
    let indexData = currPage.data.indexData;
    let districtCode = currPage.data.districtCode;
    let netStatus = currPage.data.netStatus;
    // debugger
    // debugger
    this.setData({
      'query.page': 1,
      'query.districtCode': districtCode || 0,
      deviceList: [],
      pickAll: false,
      districtName,
      indexData,
      'query.netStatus': this.data.pickerArray.find(it=>it.name==this.data.pickerArray[this.data.selectedIndex].name).value,
      'query.operationType': app.globalData.operationType
    })
    this.getAllDeviceAll();
    wx.stopPullDownRefresh();
    this.setLanguage();
  },

相关推荐

  1. uniapp实现过滤查询列表

    2024-05-25 20:12:38       29 阅读
  2. uniApp实现列表触底加载更多功能

    2024-05-25 20:12:38       30 阅读
  3. uniapp刷新

    2024-05-25 20:12:38       72 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-05-25 20:12:38       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-05-25 20:12:38       100 阅读
  3. 在Django里面运行非项目文件

    2024-05-25 20:12:38       82 阅读
  4. Python语言-面向对象

    2024-05-25 20:12:38       91 阅读

热门阅读

  1. 邦芒面试:面试礼仪细节大揭秘

    2024-05-25 20:12:38       31 阅读
  2. Bitmap 的基本原理

    2024-05-25 20:12:38       30 阅读
  3. 共享内存bug

    2024-05-25 20:12:38       29 阅读
  4. leensa邀请码

    2024-05-25 20:12:38       33 阅读
  5. es索引同步

    2024-05-25 20:12:38       29 阅读
  6. Hadoop 再探讨

    2024-05-25 20:12:38       26 阅读
  7. Django rest_framework 基础应用

    2024-05-25 20:12:38       29 阅读
  8. P2P 技术:点对点网络的兴起

    2024-05-25 20:12:38       29 阅读
  9. Android 录音AudioRecord

    2024-05-25 20:12:38       34 阅读