M
M
Mikhail Pakhmutov2021-03-26 16:57:13
Vue.js
Mikhail Pakhmutov, 2021-03-26 16:57:13

Vue: How to use dynamic names in v-for loop?

<slot v-for="area in `${ this.$route.params.type }Areas`">


Help, please, to form a cycle line. Using backticks, even if just the name is correct inside write the cycle will not start, and without them you cannot dynamically set the array name

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2021-03-26
@ARCHANG3L

Make a getter and calculate the name there. Well, accordingly, return the desired property, and not a string, as it is now.
For example: https://jsfiddle.net/yarkov_aleksei/1ub0enxq/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question