FormPage

表单页面,规定了标准表单的顶部的标题和底部的按钮提示等区域的规范

代码引入

在 page.json 中引入组件

  1. {
  2. "usingComponents": {
  3. "mp-form-page": "../../components/form-page/form-page",
  4. "mp-form": "../../components/form/form"
  5. }
  6. }

示例代码

  1. <!--WXML示例代码-->
  2. <mp-form-page title="表单结构" subtitle="展示表单页面的信息结构样式, 分别由头部区域/控件区域/提示区域/操作区域和底部信息区域组成。">
  3. <mp-form id="form" rules="{{rules}}" models="{{formData}}">
  4. </mp-form>
  5. <checkbox-group slot="tips" bindchange="bindAgreeChange">
  6. <label class="weui-agree" for="weuiAgree">
  7. <view class="weui-agree__text">
  8. <checkbox class="weui-agree__checkbox" id="weuiAgree" value="agree" checked="{{isAgree}}" />
  9. <view class="weui-agree__checkbox-icon">
  10. <icon class="weui-agree__checkbox-icon-check" type="success_no_circle" size="9" wx:if="{{isAgree}}"></icon>
  11. </view>
  12. 阅读并同意<navigator url="" class="weui-agree__link">《相关条款》</navigator>
  13. </view>
  14. </label>
  15. </checkbox-group>
  16. <view slot="button">
  17. <button class="weui-btn" type="primary" bindtap="submitForm">确定</button>
  18. </view>
  19. </mp-form-page>

效果展示

FormPage - 图1

属性列表

属性类型默认值必填说明
titlestring标题
subtitleboolean副标题

Slot

名称描述
title标题区域slot和title属性互斥
tips底部确认按钮前面的提示区域
button底部提交按钮区域
suffixtips提交按钮下面的提示区域
footer页脚的内容区域