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

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

亚连
Release: 2018-06-01 10:29:01
Original
1702 people have browsed it

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
Copy after login

New object syntax

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

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!

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!