Home  >  Q&A  >  body text

javascript - vue gets json data and assigns it to this.data. Why do some key-value pairs appear undefined?


teamData is json obtained from the backend. When using it to make data driver, it always appears,,,,undefined,
Instead, assign those arrays as Empty, and the second-level str is also assigned an empty value, you will not encounter this situation.
How to understand this?

phpcn_u1582phpcn_u15822711 days ago819

reply all(3)I'll reply

  • PHP中文网

    PHP中文网2017-05-19 10:17:28

    Because it is an Object, when you first load it to get the data, it will definitely be undefined. The official said that it is best to declare all properties in advance. Regardless of whether there is data or not, give him null,

    reply
    0
  • 淡淡烟草味

    淡淡烟草味2017-05-19 10:17:28

    • Make sure you can get json data instead of undefined

    • Where did you get the data? Post it and take a look

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-05-19 10:17:28

    JSON.parse(res)

    reply
    0
  • Cancelreply