This time I will bring you vue v-forLoopcheckboxThe first one is checked by default, vue v-for loopcheckbox What are the precautions that are checked by default? The following is a practical case, let’s take a look.
Application scenario: When making multiple selections, the first one is generally displayed by default.
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"为索引为0的,即为第一个复选框添加属性。
Expansion: The check box that is selected by default only needs to be specified by index.
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Web-side application implements back force refresh
How to use automatic generator in ionic2
The above is the detailed content of The loop checkbox of vue v-for has the first one checked by default. For more information, please follow other related articles on the PHP Chinese website!