[Vuejs]-Want to keep value to one state of toggle button based on some condition check

0👍

<toggle-input class="library__action--desktop" :value="lib" @change="activeInactiveCheck(lib)" />

Keep this line like above and set the value of “lib” from view controller where you want to keep it on/off on the given condition.

You can also set it to true/false on controller initialisation.

Also, you don’t need to do this

this.$emit('input', event.target.value = false );

Instead, you can just set “lib” to true/false.

Leave a comment