1. 程式人生 > >vetur外掛提示 [vue-language-server] Elements in iteration expect to have 'v-bind:key' directives錯誤的解決辦法

vetur外掛提示 [vue-language-server] Elements in iteration expect to have 'v-bind:key' directives錯誤的解決辦法

錯誤提示:

[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

使用VS Code 出現如下問題,如圖

Vue 2.2.0+的版本里,當在元件中使用v-for時,key是必須的。

更改vetur配置            vscode->首選項->設定->搜尋(vetur)

"vetur.validation.template"
: true,

改成:false