您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

微信小程序之form组件的介绍

2025/11/26 16:45:24发布30次查看
这篇文章主要介绍了微信小程序form组件详细介绍的相关资料,需要的朋友可以参考下
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为页面跳转所带来的参数 }})
以上就是本文的全部内容,希望对大家的学习有所帮助,更多相关内容请关注!
相关推荐:
微信小程序模拟cookie的实现
微信小程序实现的贪吃蛇游戏【附源码】
以上就是微信小程序之form组件的介绍的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product