<view class="container"> <view class="page-body"> <form catchsubmit="formSubmit" catchreset="formReset"> <block wx:for="{{3}}"> <view class="page-section"> <view class="page-section-title">input</view> <view class="weui-cells weui-cells_after-title"> <view class="weui-cell weui-cell_input"> <view class="weui-cell__bd" style="margin: 30rpx 0" > <input class="weui-input" name="input{{index}}" placeholder="这是一个输入框" /> </view> </view> </view> </view> </block> <view class="btn-area"> <button style="margin: 30rpx 0" type="primary" formType="submit">Submit</button> <button style="margin: 30rpx 0" formType="reset">Reset</button> </view> </form> </view> </view>
Page({ onShareAppMessage() { return { title: 'form', path: 'page/component/pages/form/form' } }, data: { pickerHidden: true, chosen: '', num:4 }, formSubmit(e) { console.log('form发生了submit事件,携带数据为:', e.detail.value) }, formReset(e) { console.log('form发生了reset事件,携带数据为:', e.detail.value) this.setData({ chosen: '' }) } })
站长微信:xiaomao0055
站长QQ:14496453