微信小程序之表单

<form class="page__bd" bindsubmit="formSubmit" bindreset="formReset">
   
    <view>求租</view>
    <view class="section">
      <view class="title">求组标题</view>
      <input bindblur="title" name="title" style="background-color: #FFFFFF" value="{{title}}" placeholder="请在这里输入" />
    </view>
    <view>
      <view class="title">地址</view>
      <input type="text" bindtap="map" value="{{address}}" name="address" />
    </view>
    <view class="section section_gap">
      <view class="section__title">性别要求</view>
      <radio-group name="sex">
        <label><radio value="1"/>男</label>
        <label><radio value="2"/>女</label>
      </radio-group>
    </view>



    <view class="section" >
      <view class="section__title">预算价格</view>
      <picker name="price" class="cybm_pic_1" value="{{price[hx_index].id}}" data-selecthx="{{price[hx_index].name}}" range="{{price}}" range-key="{{'price'}}"  bindchange="bindPickerChange_hx"  >
        <view class="picker" >
         价格:  {{price[hx_index].price}} 
        </view>
      </picker>
    </view>


    <view class="section" >
      <view class="section__title">户型</view>
      <picker name="type" class="cybm_pic_1" value="{{type[type_index].id}}" data-selecthx="{{type[type_index].name}}" range="{{type}}" range-key="{{'type'}}"  bindchange="bindPickerChange_type"  >
        <view class="picker" >
         户型:  {{type[type_index].type}} 
        </view>
      </picker>
    </view>

    <view class="section" >
      <view class="section__title">电话</view>
      <input bindblur="phone" name="phone" style="background-color: #FFFFFF" value="{{phone}}" placeholder="请在这里输入" />
    </view>

    <view class="section" >
      <view class="section__title">期望</view>
      <input bindblur="text" name="text" style="background-color: #FFFFFF" value="{{text}}" placeholder="请在这里输入" />
    </view>


    <view class="btn-area">
      <button form-type="submit">Submit提交</button>
      <button form-type="reset">Reset重置</button>
    </view>
  </form>

微信下拉逻辑

data:{
       price:[],
    hx_index:0,
} 

 bindPickerChange_hx: function(e) {
    let hx_index = e.detail.value;
    this.setData({
      hx_index,
    })
    let _token =wx.getStorageSync('token');
    wx.request({
      url: 'http://www.laravel8.com/api/wx/price',
      data:{_token},
      success:res=>{
        // console.log(res)
        let price = res.data.data
        if(res.data.code==200){
          this.setData({
            price
          })
        }
      }
    })
  },

表单提交

 formSubmit: function(e) {
    // console.log('form发生了submit事件,携带数据为:', e.detail.value)
    this.setData({
      allValue:e.detail.value
    })
    let _token =wx.getStorageSync('token');
    let allValue = this.data.allValue
   
    wx.request({})
   }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值