Home  >  Article  >  Web Front-end  >  Detailed graphic explanation of v-for iteration syntax in Vue2.0

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

php中世界最好的语言
php中世界最好的语言Original
2018-04-11 17:35:331841browse

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

New object syntax

value in obj (value, key) in obj 
(value, key, index) in obj

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!

Statement:
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