微信小程序把玩(十六)form组件
2016-09-26 07:44
369 查看
form表单组件 是提交form内的所有选中属性的值,注意每个form表单内的组件都必须有name属性指定否则提交不上去,button中的type两个submit,reset属性分别对应form的两个事件
主要属性:
wxml
<form bindsubmit="listenFormSubmit" bindreser="listenFormReser" > <checkbox-group name="checkbox" bindchange="listenerCheckbox"> <label style="display: flex" wx:for-items="{{items}}"> <checkbox value="{{item.name}}"/>{{item.value}} </label> </checkbox-group> <!--button formType属性两个可选值submit, reset分别会触发form的submit,reser事件 --> <button formType="submit" type="primary">提交</button> <button formType="reset" type="warn">重置</button> </form>
js
Page({ /** * 初始化数据 */ data:{ items: [ {name: 'JAVA', value: 'Android', checked: 'true'}, {name: 'Object-C', value: 'IOS'}, {name: 'JSX', value: 'ReactNative'}, {name: 'JS', value: 'wechat'}, {name: 'Python', value: 'Web'} ] }, listenCheckboxChange: function() { console.log(e.detail.value); }, onLoad:function(options){ // 页面初始化 options为页面跳转所带来的参数 } })
相关文章推荐
- 如何测试微信应用号
- 微信小程序把玩(十五)checkbox组件
- 微信小程序手机归属地查询功能实现
- 微信小程序笔记
- 也谈微信小程序
- 详解微信小程序开发教程
- 为什么值得做微信公众号,拾方易告诉你
- 微信公众号iphone标题栏动态设置标题
- 原生js解决微信在iOS上无法修改title的问题
- 基于微信的微交易系统开发“小程序”初试牛刀
- 微信-小程序,万众瞩目!!!
- 浅谈微信公众号营销背后的技术
- 大概看了一下微信小程序的感想
- 微信小程序资源汇总整理
- 小程序de 一些经验1
- 来自于微信小程序的一封简讯
- 来自于微信小程序的一封简讯
- 微信小程序把玩(十四)button组件
- 微信开发简易教程
- 微信小程序把玩(十三)progress组件