vue 在 vscode 開發過程中報錯問題:
代碼:
<ul> <li v-for="author in articles"> <img :src="author.images.medium" width="100"> <br> <span v-text="author.title"></span> </li> </ul>
報錯信息:
[eslint-plugin-vue][vue/require-v-for-key] Elements in iteration expect to have 'v-bind:key' directives.
解決辦法:
這是因為安裝了ESLint插件,對vue進行了eslint檢查,只需將這個規則檢查屏蔽掉即可,具體操作如下:
文件–》首選項–》設置–》在搜索框中輸入:vetur.validation.template–》找到vetur.validation.template:true–》將vetur.validation.template:true在右欄框中進行重置為false就ok了。
[eslint-plugin-vue][vue/require-v-for-key] Elements in iteration expect to have 'v-bind:key' directives.