WeChat applet component explanation and analysis: checkbox option introduction

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.