vue 报错:Elements in iteration expect to have ‘v-bind:key‘ directives
Vue2.0不同于Vue1.0版本,它把$index和$key都移除了,取而代之的是:key属性。
如果还像之前那样写的话会报Property or method "$index" is not defined on the instance but referenced during render. Make sure that this property is reactive, either in the data option, or for class-based components, by initializing the property.之类的错误。
Vue1.0版本的写法为:
<ul id="example"><li v-for="item in items">{{$index}}{{$key}}</li>
</ul>
Vue2.0版本的写法为:
<ul id="example"><li v-for="(item,index) in items" :key="item.index">{{item}}{{index}}</li>
</ul>
另一个办法是在build处关闭eslint检测(没试过)
...(config.dev.useEslint ? [createLintingRule()] : []),
参考:https://my.oschina.net/u/3986411/blog/2906924
和 https://www.jianshu.com/p/2cf1a0736154
vue 报错:Elements in iteration expect to have ‘v-bind:key‘ directives相关推荐
- vue解决v-for报错 [vue/valid-v-for]Custom elements in iteration require ‘v-bind:key‘ directives
v-for报错 [vue/valid-v-for]Custom elements in iteration require 'v-bind:key' directives.eslint-plugin- ...
- 记Vue报错Custom elements in iteration require ‘v-bind:key‘ directives.“错误解决
在使用v-for时会出现v-for报错 [vue/valid-v-for]Custom elements in iteration require 'v-bind:key' directives.es ...
- vue/require-v-for-key]Elements in iteration expect to have ‘v-bind:key‘ directives
报错内容:[vue/require-v-for-key]Elements in iteration expect to have 'v-bind:key' directives.解决:加上v-bind ...
- vue使用报错记录(cli4):[vue/valid-v-for] Custom elements in iteration require ‘v-bind:key‘ direc
问题: [vue/valid-v-for] Custom elements in iteration require 'v-bind:key' directives.eslint-plugin-vue ...
- Elements in iteration expect to have v-bind:key directives错误的解决办法
一.错误如下 [eslint-plugin-vue] [vue/require-v-for-key] Elements in iteration expect to have 'v-bind:key' ...
- 解决: Elements in iteration expect to have ‘v-bind:key‘ directives
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 报错: Elements in iteration expect to have 'v-bind:k ...
- Error:Elements in iteration expect to have ‘v-bind:key‘ directives
Error:Elements in iteration expect to have 'v-bind:key' directives 报错如下 解决办法 查看官网教程截取部分文字如下图 怎么解决呢? ...
- Vue报错:Error while running task D:\vue\forum:build with message‘spawn vue-cli-service ENOENT‘
Vue报错:Error while running task D:\vue\vueforum\forum:build with message'spawn vue-cli-service ENOENT ...
- vue 报错unknown custom element解决方法
vue 报错unknown custom element解决方法 参考文章: (1)vue 报错unknown custom element解决方法 (2)https://www.cnblogs.co ...
- vue 报错 Cannot read property ‘__ob__‘ of undefined的解决方法
vue 报错 Cannot read property '__ob__' of undefined的解决方法 参考文章: (1)vue 报错 Cannot read property '__ob__' ...
最新文章
- GDC2016 Epic Games【Bullet Train】 新风格的VR-FPS的制作方法
- HTML的标签描述16
- 平方的观测值表概率_中央气象台:“三九”大概率不会比“二九”更冷
- spring beans源码解读之--bean definiton解析器
- Linux学习之系统编程篇: 阻塞信号集、未决信号集、自定义信号集
- 2018第一季度全球畅销手机排行出炉,苹果刷榜,小米三星各一款
- 650c公路车推荐_盘点2020年各价位高性价比入门公路车
- ruby的optparse使用小记
- 张朝阳:知识直播是长久的事情 商业模式将水到渠成
- 织梦内容模型管理(人才招聘)
- SIP协议及与Freeswitch的关系
- Microsoft Excel 教程 如何在 Excel 中隐藏或显示行或列?
- 奥维地图看历史影像_如何在奥维中使用中国资源卫星影像图 | 奥维互动地图浏览器...
- matlab变量命名中文,Matlab变量及命名规则
- 华为鸿蒙系统手机会卡吗,鸿蒙系统的手机,会像安卓一样越来越卡吗?
- panda经典四道题期末考核分享
- ChatGPT 爆火!谷歌、微软、百度纷纷下场?
- 快递单打印专家 免费
- R语言 Hurst指数计算
- 【转载】使用Pytorch进行图像分类,AI challenger 农作物病害分类竞赛源码解读