vue使用v-for时vscode报错 Elements in iteration expect to have 'v-bind:key' directives

Vue 2.2.0+的版本里,当在组件中使用v-for时,key是必须的
错误提示:
[vue-language-server] Elements in iteration expect to have 'v-bind:key' directives.
Renders the element or template block multiple times based on the source data
原因是eslint检测出现bug
---------------------
解决方法:
1.在v-for 后添加 :key='item'
<li v-for="i in list" :key="i">

<div class="item" v-for="(user,index) in datalist" :key='index' >

2.在build处关闭eslint检测
...(config.dev.useEslint ? [createLintingRule()] : []),

3.更改vetur配置 vscode->首选项->设置->搜索(vetur)
"vetur.validation.template": true,
改成:false

vue使用v-for时vscode报错 Elements in iteration expect to have 'v-bind:key' directives的更多相关文章

  1. v-for 在 VSCode 中出现 Elements in iteration expect to have 'v-bind:key' directives.

    在 VSCode 中编辑代码时,在有 v-for 的语句下面有一条红色波浪线,鼠标放上去有提示 Elements in iteration expect to have 'v-bind:key' di ...

  2. vue项目使用echarts按需引入实现地图动态显示效果时,报错:TypeError: Cannot read property 'dataToPoint' of undefined

    vue项目使用echarts按需引入实现地图动态显示效果时,报错:TypeError: Cannot read property 'dataToPoint' of undefined 借鉴了该大神的文 ...

  3. 使用vue时,报错“exports is not defined”

    在开发中引用插件时,报错“exports is not defined” 但在引用第三方组件的时候,在浏览器中报错“exports is not defined”.根据浏览器报错信息,查询到报错来源是 ...

  4. saltstack配置安装的一些关键步骤及安装时各种报错的分析

    以下其他仅做参考,官方网址才是安装重点:http://docs.saltstack.cn/topics/installation/rhel.html 与安装相关的一些文档或资料: 一.linux服务器 ...

  5. Vue学习笔记-vue-element-admin 按装报错再按装

    一  使用环境 开发系统: windows 后端IDE: PyCharm 前端IDE: VSCode 数据库: msyql,navicat 编程语言: python3.7  (Windows x86- ...

  6. 【PostgreSQL】PostgreSQL添加新服务器连接时,报错“Server doesn't listen ”,已解决。

    PostgreSQL添加新的服务器连接时,报错:

  7. hibernate有关联关系删除子表时可能会报错,可以用个clear避免错误

    //清除子表数据 public SalesSet removeSalesSetDistributor(SalesSet salesSet ){ List<SalesSetDistributor& ...

  8. CentOS命令登录MySQL时,报错ERROR 1045 (28000):

    CentOS命令登录MySQL时,报错ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)错误解 ...

  9. Ansible 脚本运行一次后,再次运行时出现报错情况,原因:ansible script 的格式不对,应改成Unix编码

    Ansible 脚本运行一次后,再次运行时出现报错情况,原因:ansible  script 的格式不对,应改成Unix编码 find . -name "*" | xargs do ...

随机推荐

  1. ftp搭建安装

    本文摘要:https://jingyan.baidu.com/article/380abd0a77ae041d90192cf4.html FTP 是File Transfer Protocol(文件传 ...

  2. javascript的数组之push()

    push()方法讲一个元素或多个元素添加到数组的末尾,并返回新数组的长度length,修改数组自身. var numbers = [1, 2, 3]; numbers.push(4); console ...

  3. table表格固定前几列,其余的滚动

    我查了好多资料,只找到一个demo <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""h ...

  4. uc/os iii移植到STM32F4---IAR开发环境

    也许是先入为主的原因,时钟用不惯Keil环境,大多数的教程都是拿keil写的,尝试将官方的uc/os iii 移植到IAR环境. 1.首先尝试从官网上下载的官方移植的代码,编译通过,但是执行会报堆栈溢 ...

  5. css----transition的应用,产生动画效果。

    应用transition属性产生动画效果 css中的transition属性设置元素的变化过程所需的时间. <!DOCTYPE html> <html> <head> ...

  6. spring boot异常积累

    1.异常:Error resolving template "xxx", template might not exist or might not be accessible.. ...

  7. shell 脚本示例

    #!/bin/sh #while true #do cd /mnt/vfw/third_meteor for sub in `ls` do cd /mnt/vfw/third_meteor/${sub ...

  8. 从手机中提取boot.img

    测试环境:nexus 5,android 6.0 怕出问题可以先用TWRP备份 adb shell su cd /dev/block/platform/msm_sdcc./by-name ls -l ...

  9. PDM:Training Models of Shape from Sets of Examples

    这篇论文介绍了一种创建柔性形状模型(Flexible Shape Models)的方法--点分布模型(Point Distribution Model).该方法使用一系列标记点来表示形状,重要的是根据 ...

  10. SpringBoot 2.x.x会拦截静态资源问题

    之前在看尚硅谷视频时,可谓是按照这老师的说法,一步一步按部就班,于是采坑了,在SpringBoot 2.x.x之前是不会对静态资源拦截的,但是现在已经普通使用2.x.x这个版本会对静态资源进行拦截.看 ...