Home > Web Front-end > H5 Tutorial > body text

The loop checkbox of vue v-for has the first one checked by default

php中世界最好的语言
Release: 2018-03-27 16:36:40
Original
2999 people have browsed it

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的,即为第一个复选框添加属性。
Copy after login

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!

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!