初心-杨瑞超个人博客诚邀您加入qq群(IT-程序猿-技术交流群):757345416

form概述

表单,将组件内的用户输入的      提交。

当点击  表单中 form-type 为 submit 的  组件时,会将表单组件中的 value 值进行提交,需要在表单组件中加上 name 来作为 key。

直接贴代码了:

form bindsubmit="formSubmit" bindreset="formReset"  view class="section section_gap"    view class="section__title"switch/view switch name="switch" /  /view  view class="section section_gap"    view class="section__title"slider/view    slider name="slider" show-value/slider  /view  view class="section"    view class="section__title"input/view    input name="input" placeholder="please input here" /  /view  view class="section section_gap"    view class="section__title"radio/view    radio-group name="radio-group"      labelradio value="radio1" /radio1/label      labelradio value="radio2" /radio2/label    /radio-group  /view  view class="section section_gap"    view class="section__title"checkbox/view    checkbox-group name="checkbox"      labelcheckbox value="checkbox1" /checkbox1/label      labelcheckbox value="checkbox2" /checkbox2/label    /checkbox-group  /view  view class="btn-area"    button form-type="submit"Submit/button    button form-type="reset"Reset/button  /view/formPage({  formSubmit(e) {    console.log('form发生了submit事件,携带数据为:', e.detail.value)  },  formReset() {    console.log('form发生了reset事件')  }})

TAG标签: 微信小程序formdata

http://www.xiaochengxub.com/read-105715.html