LoginSignup
0
0

More than 3 years have passed since last update.

vue component の 配列データを更新したのに値がviewに反映されない。

Last updated at Posted at 2020-11-13

LTするまでもないが、簡単なのにVue ですげーハマった話。

問題

  • vue component の Array data に対して、代入更新を行ったのに、template に反映されない。

解決

直接代入を行っても、vue側のレンダリングトリガーを引くことができないため、規定のレンダリングトリガーに対応したmethod を call する必要がある。

push, splice, shift… など。

これが起きた時には、 this.$nexttik は有効に働かないので、上記のトリガーを引かせる。
直接代入はやめようぜって話だった。

参考になったlink
- https://aqua-engineer.com/vue-js-reactve/
- https://jp.vuejs.org/2016/02/06/common-gotchas/

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