form.wxml 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <mp-toptips msg="{{error}}" type="error" show="{{error}}"></mp-toptips>
  2. <mp-form-page title="表单结构" subtitle="展示表单页面的信息结构样式, 分别由头部区域/控件区域/提示区域/操作区域和底部信息区域组成。">
  3. <mp-form id="form" rules="{{rules}}" models="{{formData}}">
  4. <mp-cells title="单选列表项">
  5. <mp-checkbox-group prop="radio" multi="{{false}}" bindchange="radioChange">
  6. <mp-checkbox wx:for="{{radioItems}}" wx:key="value" label="{{item.name}}" value="{{item.value}}" checked="{{item.checked}}"></mp-checkbox>
  7. </mp-checkbox-group>
  8. </mp-cells>
  9. <mp-cells title="复选列表项">
  10. <mp-checkbox-group prop="checkbox" multi="{{true}}" bindchange="checkboxChange">
  11. <mp-checkbox wx:for="{{checkboxItems}}" wx:key="value" label="{{item.name}}" value="{{item.value}}" checked="{{item.checked}}"></mp-checkbox>
  12. </mp-checkbox-group>
  13. </mp-cells>
  14. <mp-cells title="表单" footer="底部说明文字底部说明文字">
  15. <mp-cell prop="name" title="姓名" ext-class="">
  16. <input bindinput="formInputChange" data-field="name" class="weui-input" placeholder="请输入姓名"/>
  17. </mp-cell>
  18. <mp-cell prop="qq" title="qq" ext-class="">
  19. <input bindinput="formInputChange" data-field="qq" class="weui-input" placeholder="请输入qq"/>
  20. </mp-cell>
  21. <mp-cell prop="mobile" title="手机号" ext-class=" weui-cell_vcode">
  22. <input bindinput="formInputChange" data-field="mobile" class="weui-input" placeholder="请输入手机号"/>
  23. <button slot="footer" type="default" class="weui-vcode-btn">获取验证码</button>
  24. </mp-cell>
  25. <mp-cell prop="date" title="日期" ext-class="">
  26. <picker data-field="date" mode="date" value="{{date}}" start="2015-09-01" end="2017-09-01" bindchange="bindDateChange">
  27. <view class="weui-input">{{date}}</view>
  28. </picker>
  29. </mp-cell>
  30. <mp-cell prop="vcode" title="验证码" ext-class=" weui-cell_vcode">
  31. <input bindinput="formInputChange" data-field="vcode" class="weui-input" placeholder="请输入验证码"/>
  32. <image slot="footer" class="weui-vcode-img" src="../images/vcode.jpg" style="width: 108px"></image>
  33. </mp-cell>
  34. </mp-cells>
  35. <mp-cells title="提交后表单项报错">
  36. <mp-cell show-error prop="idcard" title="卡号" ext-class="">
  37. <input bindinput="formInputChange" data-field="idcard" class="weui-input" placeholder="请输入卡号"/>
  38. </mp-cell>
  39. </mp-cells>
  40. <mp-cells title="开关">
  41. <mp-cell title="标题文字" ext-class="">
  42. <switch slot="footer" checked />
  43. </mp-cell>
  44. </mp-cells>
  45. <mp-cells title="文本框">
  46. <mp-cell title="标题文字" ext-class="">
  47. <input class="weui-input" placeholder="请输入文本" />
  48. </mp-cell>
  49. </mp-cells>
  50. <mp-cells title="文本域">
  51. <mp-cell has-header="{{false}}" has-footer="{{false}}" title="" ext-class="">
  52. <textarea class="weui-textarea" placeholder="请输入文本" style="height: 3.3em" />
  53. <view class="weui-textarea-counter">0/200</view>
  54. </mp-cell>
  55. </mp-cells>
  56. <mp-cells title="选择">
  57. <mp-cell ext-class="weui-cell_select weui-cell_select-before">
  58. <view slot="title" style="width: 105px">
  59. <picker bindchange="bindCountryCodeChange" value="{{countryCodeIndex}}" range="{{countryCodes}}">
  60. <view class="weui-select">{{countryCodes[countryCodeIndex]}}</view>
  61. </picker>
  62. </view>
  63. <input class="weui-input" placeholder="请输入号码" />
  64. </mp-cell>
  65. </mp-cells>
  66. <mp-cells title="选择">
  67. <mp-cell has-header="{{false}}" ext-class="weui-cell_select">
  68. <picker bindchange="bindAccountChange" value="{{accountIndex}}" range="{{accounts}}">
  69. <view class="weui-select">{{accounts[accountIndex]}}</view>
  70. </picker>
  71. </mp-cell>
  72. <mp-cell ext-class="weui-cell_select weui-cell_select-after">
  73. <view slot="title" class="weui-label">国家/地区</view>
  74. <picker bindchange="bindCountryChange" value="{{countryIndex}}" range="{{countries}}">
  75. <view class="weui-select">{{countries[countryIndex]}}</view>
  76. </picker>
  77. </mp-cell>
  78. </mp-cells>
  79. </mp-form>
  80. <checkbox-group slot="tips" bindchange="bindAgreeChange">
  81. <label class="weui-agree" for="weuiAgree">
  82. <view class="weui-agree__text">
  83. <checkbox class="weui-agree__checkbox" id="weuiAgree" value="agree" checked="{{isAgree}}" />
  84. <view class="weui-agree__checkbox-icon">
  85. <icon class="weui-agree__checkbox-icon-check" type="success_no_circle" size="9" wx:if="{{isAgree}}"></icon>
  86. </view>
  87. 阅读并同意<navigator url="" class="weui-agree__link">《相关条款》</navigator>
  88. </view>
  89. </label>
  90. </checkbox-group>
  91. <view slot="button">
  92. <button class="weui-btn" type="primary" bindtap="submitForm">确定</button>
  93. </view>
  94. </mp-form-page>