v-for should get a reformed data from axios response

Viewed 32

I'm trying to use a method as a resource of my array that will be used for v-loop.

View:

<template v-slot:cell(test)="row"> 
      <div v-for="item in get(row.item)">
        <b-row>
          <b-col>{{item}}</b-col>  
        </b-row>
      </div>
</template>

Method:

  get(values) {
  let val = "Test";
  let promise = axios.get("record/" + val)
    .then((response) => {
       return response.data
    }); 

  let get = promise.then((a) => {
        // this console log prints an array which will be used for v-for
        console.log(a)
        return a
  });
  console.log(get);
  return get;     
  }

Tried to print out the value of the method but I'm getting :

Promise {<pending>} 

Instead of getting the array from response.

Thanks in advance!

0 Answers
Related