-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can Vue add support for checkbox's indeterminate state? #4094
Comments
|
I saw that you're requesting Vue 1.x so I made the one-line directive for you with an example: http://codepen.io/sirlancelot/pen/BQBVvz (I also added an untested, commented out Vue 2.x version) |
The problem is what value in JS should be used to represent this visual state - it may totally depend on your use case and app logic. So it's probably better to handle it in your own code, as @sirlancelot suggested. |
@yyx990803 to be fair, checkboxes already support binding of |
According to WC3, indeterminate is not a distinct state as checked and unchecked are. Instead it "obscures" the actual state of the checkbox without changing it. Thus, it's more of a candidate for
@yyx990803 what's your final word on how should I proceed with this, core or userland? |
@simplesmiler I still think this belongs more in userland. In fact in 2.0 you can simply do: <input type="checkbox" :indeterminate.prop="true"> In v1, a simple custom directive would do. |
Any way to set something like
someFunc (id) {
return {
checked: true,
'indeterminate.prop': true
}
} |
@rhyek, you can use this way to one-way binding: <input type="checkbox" v-bind.prop="state(id)"> state(id) {
return {
checked: true,
indeterminate: true
}
} I couldn't find a way how to create proper getter of |
I have implemented and published a fully functional Vue.js component for a cycling tristate checkbox now. It supports click-cycling through all three states, |
Vue.js version
1.0.26
What is Expected?
The checkboxes binded with Vuejs can have THREE states: true, false, or indeterminate. For example, when binded with a checkbox and the value is "indeterminate", the checkbox's indeterminate property is set to true.
What is actually happening?
The checkboxes that binded with Vuejs only got two states: true or false.
The text was updated successfully, but these errors were encountered: