小程序开发记录

1. Picker选择器

json格式如[{TransactionNumber=1,VendorName="百度"},{TransactionNumber=2,VendorName="保科院"}]

      <picker bindchange="bindPickerChange" value="{{index}}" range="{{company}}" range-key="VendorName" data-id='{{type[index].TransactionNumber}}'>
        <view class="title">
          需方{{company[index].VendorName}}
        </view>
      </picker>

  js:带filter筛选

var that=this;  
    //绑定公司信息
    wx.request({
      url: app.globalData.API + 'VendorInfo',
      header: {
        "Content-Type": "applicatiSon/x-www-form-urlencoded"
      },
      method: "GET",
      success: function (res) {
        var company = res.data.filter((p)=>{
          return p.VendorType==1
        });
        var supllay = res.data.filter((p)=>{
          return p.VendorType!=1
        });
  
        that.setData({ 
          company:company,
          supllay:supllay
        })
      }

  

原文地址:https://www.cnblogs.com/madyina/p/14022719.html