Answer the question
In order to leave comments, you need to log in
What is the correct way to write variables to an attribute of a Vuejs element?
Hello!
I'm still new to vue
so I have the same problem.
<div class="list-group">
<template v-for="(user, i) in users">
<router-link class="list-group-item" to="/user/{{user.id}}">{{ i }}: {{ user.name }}</router-link>
</template>
</div>
<script>
export default{
data(){
return{
users:[
{name:'User 1', id: 45},
{name:'User 2', id: 55},
{name:'User 3', id: 63},
{name:'User 4', id: 82},
{name:'User 5', id: 16}
],
}
},
}
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question