Home  >  Q&A  >  body text

Vue assignment, is this allowed?

The returned json format is {"desc":"OK","status":1000,"data":{"wendu":"17","type": "clear", "yesterday" :{"wendu": "20", "type":"Cloudy"},"city":"Beijing"}}

registerData.wendu can be displayed normally, but registerData.yesterday.type reports an error

给我你的怀抱给我你的怀抱2711 days ago725

reply all(4)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:40:14

    Your json format is not legal at all.

    Let you change his code in the background, the format is wrong


    The data can be extracted according to the format you provided later. You can console.log() to output your registerData.
    Maybe there is an extra layer of data inside

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:40:14

    The brackets are wrong. . The additional json should be in double quotes

    reply
    0
  • PHP中文网

    PHP中文网2017-05-19 10:40:14

    Single quotes cannot be used in JSON

    {"data": {{"wendu": "17", "type": "晴"}, "yesterday": {"wendu": "20", "type": "多云"}}

    reply
    0
  • 習慣沉默

    習慣沉默2017-05-19 10:40:14

    ....Forget it, I can't understand the description of the problem

    reply
    0
  • Cancelreply