I only want to add a click event when !date.disabled || date.availability === 'none'. How can I do that?
<div
@click="!date.disabled || date.availability !== 'none' ? selectDate(date) : null">
{{date}}
</div>
CodePudding user response:
You could just try <button @click="(!date.disabled || date.availability !== 'none') ? selectDate() : null">Greet</button>
CodePudding user response:
You can simply achieve it by using an AND (&&) operator without using ternary operator.
@click="(!date.disabled || date.availability !== 'none') && selectDate(date)"
If condition passed then only selectDate method will get trigger else nothing will happen.
