The Firestore database field (reviewPrivacy
in the review
collection) is of string type, populated from a Vue form entry (radio) with one of three three possible answers (values): keepFullyPrivate
being among them.
I'm trying to only display <h2>The reviewer's identity is private</h2>
if the value of review.reviewPrivacy
is keepFullyPrivate
.
Once this is working, I'll add a v-if-else
and then v-else
options, displaying different content for each.
My code is below.
There aren't any errors flagged in VSC, but it doesn't matter what the value of review.reviewPrivacy
is - the text in the <h2>
tags always displays, regardless of whether or not it's equal to keepFullyPrivate
<div v-if="('review.reviewPrivacy', '==', 'keepFullyPrivate')"><h2>The reviewer's identity is private</h2></div>
Update (additional info):
- I'm using Vue version 3.2.1
- The data from Firestore is fetching correctly. For example, in the same parent as the code above, this line
<p> Privacy choice for this review: {{ review.reviewPrivacy }} </p>
results in the following text in the DOM: Privacy choice for this review: postAnonPublic, which is thev-else-if
condition.
2nd update: code as a full block, as requested in comments:
<div class="review-detailZ">
<div> <!-- BEGIN main (left-hand) column -->
<p> Privacy choice for this review: {{ review.reviewPrivacy }} </p>
<br />
<!-- Using Vue version 3.2.1 -->
<div v-if="('review.reviewPrivacy', '==', 'keepFullyPrivate')"><h2>The reviewer's identity is private</h2></div>
<div v-else-if="('review.reviewPrivacy', '==', 'postAnonPublic')"><h2>Incognito - review by{{ review.userName }}</h2></div>
<div v-else><h2>Reviewer chose to be fully public - full name is {{ review.userFirstName }} {{ review.userLastName }}</h2></div>
<br />
<p>Created {{ review.createdAt }} days ago</p>
<br />
</div>
Thanks!