0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Vue.js開発中のエラー対処

Posted at

この記事について

Vue.js開発中のエラーについて備忘。

開発環境

  • Mac OS
  • Node.js v12.13.1
  • npm 6.12.1
  • Vue CLI 3.9.0
  • vue 2.6.2
  • Mac OS

エラー

[Vue warn]: Avoid using non-primitive value as key, use string/number value instead.

原因
v-forのkeyに配列やオブジェクトを指定しているために発生するエラー

NG
<div v-for="item in items" :key="item">
  {{item}}
</div>
OK
<div v-for="(item, index) in items" :key="index">
  {{item}}
</div>

参考サイト:
vuejs 開発時に遭遇したエラーリスト

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?