Home > Web Front-end > JS Tutorial > Solve v-for usage red reporting example in vue

Solve v-for usage red reporting example in vue

小云云
Release: 2018-03-16 17:29:53
Original
1677 people have browsed it

This article mainly shares with you how to solve the red and warning problems when using v-for in vue. I hope it can help everyone. Code red reporting is very uncomfortable for patients with obsessive-compulsive disorder who pursue beautiful code. The red reporting is as follows:

There will also be in the console:

(Emitted value instead of an instance of Error)

To solve this red reporting problem, we need to follow his prompts and add a unique key during the loop. Here we choose to use index:

<ul class="clearfix course-list">
<li class="left" v-for="(item,index)in gradeClassfy.primary.grade":key="index"><ahref="#">{{item.name}}</a></li>
</ul>
Copy after login

In this way, the red report disappears.

Related recommendations:

Vue.js list rendering v-for array object subcomponent

Examples to explain vue v-for data Processing

Circular use of v-for instruction example code

The above is the detailed content of Solve v-for usage red reporting example in vue. 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