How to show only one button per every distinct date
?
can i use two v-for loops ? how to select distinct values in my loop?
<div v-for="question in allQuestions" >
<button v-for="date in question.date">
{{date}}
</button>
</div>
Data model :
allQuestions : []
question : {'id' : '123' , 'date' : '25'}
allQuestions : [ question : {'id' : '123' , [{'date' : '25'},{'date' : '25'},{'date' : '27'}]}, ]
– Ptolemaic<button v-for="date in question.date"> {{date.id}} </button>
– PtolemaicallQuestions
array have nothing in it. put yourquestion
object inside yourallQuestion
array. – PtolemaicallQuestions = [ { question : [ {'id' : '1' , 'date' : '25'}, {'id' : '2' , 'date' : '26'}, {'id' : '3' , 'date' : '27'} ] } ]
– Ptolemaic