Home  >  Article  >  Web Front-end  >  Detailed introduction to the changes in v-for iteration syntax in Vue2.0 (detailed tutorial)

Detailed introduction to the changes in v-for iteration syntax in Vue2.0 (detailed tutorial)

亚连
亚连Original
2018-06-01 10:29:011746browse

Below I will share with you a brief discussion of the changes in v-for iteration syntax (key, index) in Vue2.0. It has a good reference value and I hope it will be helpful to everyone.

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

The result is the key of this object The value cannot be displayed:

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

Discarded:

##New array syntax

value in arr 
(value, index) in arr

New object syntax

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

After solving:

The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.

Related articles:

What are the methods to reload the current routing page according to AngularJS?

How to implement random switching code of WeChat ID through JavaScript (detailed tutorial)

Use ES6 to solve the memory leak problem through WeakMap (detailed tutorial)

The above is the detailed content of Detailed introduction to the changes in v-for iteration syntax in Vue2.0 (detailed tutorial). 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