B
B
bqio2019-03-09 09:02:19
JavaScript
bqio, 2019-03-09 09:02:19

Why doesn't the loop in template wait for a promise?

There is a loop in the template:

<td v-for="type in rank">
  <img v-for="hero in type" :src="load(hero)">
</td>

And there is a method:
async load (name) {
  const response = await axios.jsonp(`url/${name}`)
  return response.url
}

Why does src get an object Promise?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alex, 2019-03-09
@bqio

Because the cycle is v-forsynchronous. It receives a response (promise) from your function and outputs it. It does not look at what kind of answer it is and does not change it in any way (Does not wait for a promise).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question