0👍
Few Observations in current code you posted :
- You are checking for
online.complete === 100
but you don’t havecomplete
property in online object. Hence, corrected that tocompleted
instead ofcomplete
. - closing braces is missing from
online.title
expression.
Now coming to the original problem :
To achieve the counts in the v-select
options. You have to convert your items array from array of elements
to array of objects
.
items: ['All', 'passed', 'not complete']
to
items: [{
name: 'All',
count: this.onlineCourse.length
}, {
name: 'passed',
count: this.onlineCourse.filter((course) => course.passed)
}, {
name: 'not complete',
count: this.onlineCourse.filter((course) => course.completed === 0)
}]
Source:stackexchange.com