I am facing an issue with the following markup in my template:
<div class="locButton" v-for="location in locResult.slice(0, 4)">
<h5>{{ location.legal_name }}</h5>
<p>{{ location.address1 }}<p>
<p v-if="location.address2 !== undefined">{{ location.address2 }}</p>
<p>{{ location.pri_phone }}</p>
</div>
However, when this is rendered on the DOM, it looks like this:
<div class="locButton">
<h5>Name</h5>
<p>Address1</p>
<p></p><!---->
<p>Phone</p>
</div>
I need a solution for the v-if condition to ensure that the html <p>
tag is not outputted at all if the property is undefined or empty.