小程序开发记录

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
        })
      }

  

posted @ 2020-11-23 08:52  石曼迪  Views(100)  Comments(0Edit  收藏  举报
瓴域建设-环保事业中心