[Vuejs]-Vue: show component depends on API status

0👍

this in a callback is not what you think it is. Try…

<div v-if="status === false ">First component</div>
<div v-if="status === true ">Second component</div>


export default  {
 data() {
  return {
   status,
  }
 },
 created: function () {
  var me = this;
  $.getJSON('linkAPI', function (json) {
    me.status = json.state;
  })
 }
}

Leave a comment