This article introduces how to interpret and analyze the mini-program components: checkbox option
Component Description of the checkbox option:
-
Checkbox is a component in the form component of the applet. it directs the user to make a choice in the form.
-
To use the checkbox component, you also need to use the checkbox-group label outside all the checkbox labels in the same group.
-
The checkbox-group tag can be used to bind an onchange event to the checkbox tag. when a user makes a choice, it can guide the user.
-
A separate checkbox tag does not trigger the onchange event. it is triggered only when it is bound to the checkbox-group.
The sample code of the checkbox option complex component runs as follows:
The following is the WXML code:
{{item.name}}
The following is the JS code:
Page ({data: {item: [{'name': 'Russian ', 'value': 'RS', 'disabled ': false}, {'name ': 'use', 'value': 'use', 'disabled ': false}, {'name': 'China', 'value': 'cn', 'disabled ': false, 'checked': true}, {'name': 'British ', 'value': 'UK', 'disabled ': false}, {'name ': 'Japan ', 'value': 'JP', 'disabled ': true}]}, changed: function (e) {console.info ('You selected' + e. detail. value );}})
The following is the WXSS code:
.items { display: block; margin: 30rpx;}
Main Attributes of the checkbox option:
Checkbox-group
|
Attribute name |
Data type |
Description |
|
Bindchange |
EventHandle |
If the selected item changes, the change event is triggered. detail = {value: [array of the value of the selected checkbox]} |
Checkbox
|
Attribute name |
Data type |
Description |
Default value |
|
Value |
String |
Identifier, triggered when selected And carry Value |
|
|
Checked |
Boolean |
Enable Selected by default |
False |
|
Disabled |
Boolean |
Enable Disabled |
False |
The above is the explanation and analysis of the mini-program component: details about the checkbox option. For more information, see other related articles in the first PHP community!