[Vuejs]-Vuejs disable button depending array length

0👍

Necropost!

but seriously, as the comments all point out, the code is perfectly fine, it is just that disabled is a negative, so you actually don’t want to test for greater than zero, you want to test for zero if it is to be disabled

<button class="submit-button"
            type="button"
            v-on:click="DoSomething()"
            v-bind:disabled="myarray.length == 0">Submit</button>

Leave a comment