This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11532|Reply: 0

[Vue] vue v-for loop checkbox - the first implementation method is checked by default

[Copy link]
Posted on 8/20/2018 10:15:18 AM | | |

Application scenarios: The first one is generally displayed by default when performing multiple selections.

Implementation method: Pure Vue implementation

Example: <span v-for="(one,index) in site"><input type="checkbox" :checked="index == 0" style="vertical-align: middle; "><label>{{one.name}}</label></span>

          :checked="index == 0" is the index of 0, i.e. add an attribute to the first checkbox.

Expanded: The checkbox is selected by default, only the index needs to be specified.




Previous:Introduction to the seven major resource records in DNS!
Next:The vue implementation is clicked to check, and the others are not selected
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com