vue-async-function icon indicating copy to clipboard operation
vue-async-function copied to clipboard

async method in v-for?

Open RezaErfani67 opened this issue 5 years ago • 2 comments

can i call async method in v-for?

RezaErfani67 avatar Apr 19 '20 18:04 RezaErfani67

Yes. But keep in mind that each component you render in v-for will trigger a separate network call. Also, if the list is often updated, this is again trigger individual network calls.

AlbertBrand avatar Apr 20 '20 06:04 AlbertBrand

excellent... can you please give me an example?

   <div  v-for="item in taskList" >
 <div v-for="(eachRow,index6) in mapGrid(item,_.clone(eachGrid))">
                  <input type="text" v-model="eachRow.text" />
 </div>
</div>

.
.
export default {
methods: {
async mapGrid(taskItem,eachGrid){
let response=await axios.get().... ;
return response;
        }
    }

}

RezaErfani67 avatar Apr 20 '20 09:04 RezaErfani67