This article mainly introduces relevant information about the detailed introduction of the form component of the WeChat applet. Friends who need it can refer to it

The form form component is all the components in the submitted form Select the value of the attribute. Note that each component in the form must have a name attribute specified, otherwise it will not be submitted. There are two submit and reset attributes in the button corresponding to the two events of the form.
Main attributes:

##wxml
1 2 3 4 5 6 7 8 9 10 11 | <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>
|
Copy after login
js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 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){
}
})
|
Copy after login
The above is the entire content of this article. I hope it will be helpful to everyone’s learning. For more related content, please pay attention to PHP Chinese net!
Related recommendations:
Implementation of cookie simulation by WeChat applet
## Snake game implemented by WeChat applet【 Source code attached】
The above is the detailed content of Introduction to the form component of WeChat mini program. For more information, please follow other related articles on the PHP Chinese website!