0

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!

Taylor
  • 57
  • 7
  • 1
    Possible duplicate of https://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call – Estus Flask Sep 16 '22 at 19:58

0 Answers0