Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat gadget WeUI FormPage


May 21, 2021 WeChat Mini Program Development Document


Table of contents


FormPage

A form page that specifies the specifications for areas such as the title at the top of the standard form and button tips at the bottom

Code introduction

Introduce components in page.json

{
  "usingComponents": {
    "mp-form-page": "../../components/form-page/form-page",
    "mp-form": "../../components/form/form"
  }
}

Sample code

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

Show results

WeChat gadget WeUI FormPage

The list of properties

Property Type The default Required Description
title string Whether Title
subtitle boolean Whether Subtitle

Slot

Name Describe
title The title area slot and title properties are mutually exclusive
tips The tip area in front of the bottom confirmation button
button The bottom submission button area
suffixtips Submit the prompt area below the button
footer The content area of the footer