微信小程序 WeUI·FormPage

2020-07-28 09:56 更新

FormPage

表單頁面,規(guī)定了標(biāo)準(zhǔn)表單的頂部的標(biāo)題和底部的按鈕提示等區(qū)域的規(guī)范

代碼引入

在 page.json 中引入組件

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

示例代碼

<!--WXML示例代碼-->
<mp-form-page title="表單結(jié)構(gòu)" subtitle="展示表單頁面的信息結(jié)構(gòu)樣式, 分別由頭部區(qū)域/控件區(qū)域/提示區(qū)域/操作區(qū)域和底部信息區(qū)域組成。">
    <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">《相關(guān)條款》</navigator>
            </view>
        </label>
    </checkbox-group>
    <view slot="button">
        <button class="weui-btn" type="primary" bindtap="submitForm">確定</button>
    </view>
</mp-form-page>

效果展示

屬性列表

屬性類型默認(rèn)值必填說明
titlestring標(biāo)題
subtitleboolean副標(biāo)題

Slot

名稱描述
title標(biāo)題區(qū)域slot和title屬性互斥
tips底部確認(rèn)按鈕前面的提示區(qū)域
button底部提交按鈕區(qū)域
suffixtips提交按鈕下面的提示區(qū)域
footer頁腳的內(nèi)容區(qū)域


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)