<!--commpents/form/index.wxml-->
<van-cell-group>
    <view wx:for="{{fields}}" wx:for-item="f" wx:key="model">
        <view wx:if="{{f.type==='select'}}">
            <f-picker value="{{form[f.model]}}" label="{{f.label}}" model="{{f.model}}" bind:selected="toSelected" columns="{{f.list}}">
            </f-picker>
        </view>
        <view wx:elif="{{f.type==='upload'}}">
            <view style="text-align:center">
                <f-upload list="{{form[f.model]}}" bind:imgUpload="uploadIcon" bind:imgDel="deleteImg"></f-upload>
            </view>
        </view>
        <view wx:elif="{{f.type==='idCard'}}">
            <van-field label="{{f.label}}">
                <view slot="input">
                    <input type="idcard" bind:input="onOChange" data-model="{{f.model}}" />
                </view>
            </van-field>
        </view>
        <view wx:else>
            <van-field label="{{f.label}}" value="{{form[f.model]}}" bind:change="onChange" data-model="{{f.model}}">
            </van-field>
        </view>
    </view>
</van-cell-group>

<view style="padding:10px">
    <button type="primary" style="width:100%" disabled="{{isSubmit}}" bind:tap="toSubmit">注册</button>
</view>