1. 程式人生 > 實用技巧 >Elements in iteration expect to have ‘v-bind:key‘ directives.eslint-plugin-vue

Elements in iteration expect to have ‘v-bind:key‘ directives.eslint-plugin-vue

背景

在使用VScode編輯器vue開發過程中,v-for在Eslint的規則檢查下出現報錯:Elements in iteration expect to have ‘v-bind:key’ directives。

報錯原因:
安裝了ESLint外掛,對vue進行了eslint檢查。

解決

檔案 ---> 首選項 --->,在搜尋框中輸入:vetur.validation.template

把勾去掉,重啟VsCode即可