mardi 4 juillet 2017

why computed property can not return anything?

i am using computed property like below to fetch data from webapi, and it tested with good json result. but when i always got error message , even i tried jQuery.parseJSON() to transfer data first, but don't know how can i pass json to data property.

computed: {

    fetchBookData:function () {
     var item;
     var bookJson=$.getJSON('/api/book/getJson',function (data) {

      item = data;

      $.each(data,function (key,val) {
         // item[key]= key;
         // item[val]= val;

      })
    });
      return item;
    }, 



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2uoepuc
via IFTTT

Aucun commentaire:

Enregistrer un commentaire