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

Detailed graphic explanation of v-for iteration syntax in Vue2.0

php中世界最好的语言
Release: 2018-04-11 17:35:33
Original
1831 people have browsed it

This time I will bring you a detailed explanation of the use of v-for iteration syntax in Vue2.0. Notes on the use of v-for iteration syntax in Vue2.0are Which ones, the following are practical cases, let’s take a look.

Today, while writing code about Vue2.0, I found that the value $key could not be rendered successfully. The problem is as follows:

Detailed graphic explanation of v-for iteration syntax in Vue2.0


As a result, the key value of this object cannot be displayed:

Detailed graphic explanation of v-for iteration syntax in Vue2.0


Later, I checked the documentation and found out that this is because in Vue2.0, the v-for iteration syntax has changed:

Discarded:

Detailed graphic explanation of v-for iteration syntax in Vue2.0

NewArraySyntax

value in arr 
(value, index) in arr
Copy after login

New object syntax

value in obj (value, key) in obj 
(value, key, index) in obj
Copy after login

After solution:

Detailed graphic explanation of v-for iteration syntax in Vue2.0

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:

How to realize the two-way binding of Vue2 parent component and child component

Solved in the vue project The problem of background image error due to incorrect path

The above is the detailed content of Detailed graphic explanation of v-for iteration syntax in Vue2.0. 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!