Detailed example code of checkbox component of WeChat applet

高洛峰
Release: 2018-05-10 15:41:17
Original
2306 people have browsed it

This article mainly introduces the detailed explanation and simple examples of the checkbox component of the WeChat applet. Friends in need can refer to the

implementation renderings:

Detailed example code of checkbox component of WeChat applet

checkbox-group

Multi-select item group, internally composed of multiple checkbox.

checkbox-group can only contain checkbox

Attribute nameTypeDefault valueDescription
bindchangeEventHandle The selected item in checkbox-group changes Trigger the change event, detail = {value:[array of value of the selected checkbox]}

checkbox

Multi-select items.

Attribute nameTypeDefault valueDescription
valueString checkbox identifier, triggers the change event of checkbox-group when selected, and carries the checkbox value
disabledBooleanfalseWhether it is disabled
checkedBoolean falseWhether it is currently selected or not, can be used to set the default selection

Example:


 
Copy after login
Page({
 data: {
 items: [
 {name: 'USA', value: '美国'},
 {name: 'CHN', value: '中国', checked: 'true'},
 {name: 'BRA', value: '巴西'},
 {name: 'JPN', value: '日本'},
 {name: 'ENG', value: '英国'},
 {name: 'TUR', value: '法国'},
 ]
 },
 checkboxChange: function(e) {
 console.log('checkbox发生change事件,携带value值为:', e.detail.value)
 }
})
Copy after login

Thanks for reading, I hope it can help everyone, thank you for your support of this site!

The above is the detailed content of Detailed example code of checkbox component of WeChat applet. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!