0π
β
Something like this, if it was possible:
<div v-if="stringNumber === 0 && fretMark2.indexOf(fret) >= 0 ? true : false">{{ <div class="fret-mark-2"></div> }}</div>
But of course in Vue2 we canβt render raw HTML with interpolation β we have to use v-html.
You donβt actually need to use string interpolation or v-html
for this. You can simply add v-if
to the conditional <div>
:
<div v-for="fret in numberOfFrets" ...>
<div v-if="stringNumber === 0 && fretMark2.indexOf(fret) >= 0"
class="fret-mark-2">
</div>
</div>
In this case, div.fret-mark-2
would only be added to the DOM if the v-if
condition evaluates to true
.
π€tony19
Source:stackexchange.com