Elements in iteration expect to have v-bind:key directives错误的解决办法
生活随笔
收集整理的這篇文章主要介紹了
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' directives.
更多專業前端知識,請上 【猿2048】www.mk2048.com
[vue/require-v-for-key]
Elements in iteration expect to have 'v-bind:key' directives.
Renders the element or template block multiple times based on the source data.
使用VS Code 出現如下問題,如圖
二、解決
在用vscode編寫vue代碼時,因為安裝的有vetur插件,所以當代碼中有v-for語法時,會提示,“Elements in iteration expect to have 'v-bind:key' directives.”這個錯誤
這是ESLint的功能,對vue進行了eslint檢查。那么我們就把eslint對該插件的檢查關閉,
更改vetur配置 ? ? ? ? ? ?vscode->首選項->設置->搜索(vetur)
?把 ?"vetur.validation.template": true??改成??false
保存,我們再看一下vue文件,發現不報錯了。?
?
?
更多專業前端知識,請上 【猿2048】www.mk2048.com
總結
以上是生活随笔為你收集整理的Elements in iteration expect to have v-bind:key directives错误的解决办法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 伪类 选择器优先级
- 下一篇: 微信小程序如何检测接收iBeacon信号