微信小程序 form表單 開關 多選 單選 輸入框 提交


<!--這裏用form,name=“nameName1”可以作爲form的屬性進行 
(e.detail.value.nameName1)調用,
form自帶有提交和重置按鈕,會自動獲取表單中所有控件值的改變-->
<form class="page__bd" bindsubmit="formSubmit" bindreset="formReset">
  <view class="section section_gap">
   <view class="section__title">switch開關</view>
   <switch name="switch"/>
  </view>
  <view class="section section_gap">
   <view class="section__title">slider滑塊</view>
   <slider value="50" name="slider" show-value ></slider>
  </view>
  <view class="section">
   <view class="section__title">input輸入框</view>
   <input name="input" style="background-color: #FFFFFF" placeholder="請在這裏輸入" />
  </view>
  <view class="section section_gap">
   <view class="section__title">radio單選</view>
   <radio-group name="radio-group">
    <label><radio value="radio1"/>radio1</label>
    <label><radio value="radio2"/>radio2</label>
   </radio-group>
  </view>
  <view class="section section_gap">
   <view class="section__title">checkbox多選</view>
   <checkbox-group name="checkbox">
    <label><checkbox value="checkbox1"/>checkbox1</label>
    <label><checkbox value="checkbox2"/>checkbox2</label>
   </checkbox-group>
  </view>
  <view class="section">
   <view class="section__title">地區選擇器</view>
   <picker name="areaPicker" bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
    <view class="picker">
     當前選擇:{{array[index]}}
    </view>
   </picker>
  </view>
  <view class="section">
   <view class="section__title">時間選擇器</view>
   <picker name="timePicker" mode="time" value="{{time}}" start="09:01" end="21:01" bindchange="bindTimeChange">
    <view class="picker">
     當前選擇: {{time}}
    </view>
   </picker>
  </view>
  <view class="section">
   <view class="section__title">日期選擇器</view>
   <picker name="datePicker" mode="date" value="{{date}}" start="2015-09-01" end="2017-09-01" bindchange="bindDateChange">
    <view class="picker">
     當前選擇: {{date}}
    </view>
   </picker>
  </view>
  <view class="btn-area">
   <button form-type="submit">Submit提交</button>
   <button form-type="reset">Reset重置</button>
  </view>
 </form>

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章