euvl / euvl/vue-js-toggle-button

v-model is confusing

Open
#115 14 comments 6 reactions 0 assignees View on GitHub
Dominant language
Vue
Stars
921
Forks
131
PR merge metrics
No merged PRs in 30d

Description

The component looks and works great, but I found something I think is a bit confusing. I would like to get the initial state from Vuex and set the button to the initial state, then I want to toggle the state with the button and set the new state in Vuex. A simple 2 way binding. v-model is usually great for that, but I found with your component I had to use v-bind, :value & :sync simultaneously for it to work that way. Using just ":value" and ":sync" I couldn't get the button to set the value in my computed property, and using just v-bind I didn't get the initial state. Perhaps you could default ":value" to whatever v-model is and default ":sync" to on to simplify things and make v-model work as most people would probably expect it to? Just a suggestion.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.