Solve the problem of red and warning when using v-for in vue
Mar 27, 2018 pm 04:02 PMThis time I will bring you a solution to v-for using red and warning in vue, vue to solve v-for using red and warning What are the precautions , the following is a practical case , let’s take a look.
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 prompts like this in the console:
(Emitted value instead of an instance of Error) <Option v-for="item in searchTypeList">: component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for more info.
. To solve this problem of red reports, we need to follow his prompts and add a unique one when loop key, choose to use index here:
<ul class="clearfix course-list"> <li class="left" v-for="(item,index) in gradeClassfy.primary.grade" :key="index"><a href="#" rel="external nofollow" >{{item.name}}</a></li> </ul>
In this way, the red report disappears.
The above article is based on solving the problem of red reporting and warning when using v-for in vue. This is all the content shared by the editor. I hope it can give you a reference. I also hope that Please support Script House a lot.
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:
Detailed graphic explanation of Vue.directive()
Detailed explanation of JsChart component usage
The above is the detailed content of Solve the problem of red and warning when using v-for in vue. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

How to enable Sensitive Content Warning on iPhone and learn about its features

Tips for using v-for to implement dynamic sorting in Vue

Detailed explanation of v-for function in Vue3: perfect solution to list data rendering
![How to solve '[Vue warn]: v-for='item in items': item' error](https://img.php.cn/upload/article/000/000/164/169241709258603.jpg?x-oss-process=image/resize,m_fill,h_207,w_330)
How to solve '[Vue warn]: v-for='item in items': item' error

Best practices and performance optimization methods for using v-for in Vue

Which one has higher priority, v-if or v-for in vue?

v-for function in Vue3: perfect solution to list data rendering
