I need to add a subheader to a list. Currently every entry with a date that is today gets a subheader but I only want to set it once. The problem seems to be that I can't access the updated value of todaySubheader
inside the <span v-if="todaySubheader
.
HTML
<template v-for="(meetup, index) in filteredItems">
<v-subheader
v-if="checkIsToday(meetup.date)"
inset
>
<span v-if="todaySubheader === false">TODAY</span>
</v-subheader>
SCRIPT
data () {
return {
todaySubheader: false,
[...]
checkIsToday (val) {
if (val && this.todaySubheader === false) {
this.todaySubheader = true
}
return isToday(new Date(val))
},
How to access the changed value of this.todaySubheader in v-if="todaySubheader?
from Add subheader to a list but only once
No comments:
Post a Comment