wffranco / vue-strap

Bootstrap components built with Vue.js
http://wffranco.github.io/vue-strap/
MIT License
338 stars 133 forks source link

v-model on checkboxes inside button group #177

Open crowincage opened 6 years ago

crowincage commented 6 years ago

I try to implement a simple button group with checkboxes to define an address type. The model looks like this:

{ ... isClient: boolean, isSupplier: boolean, isManufacturer: boolean, ... }

If I use the button group like this with checked = []

`

Client Supplier Manufacturer

`

it's not possible to check a single button. If I check for example the isClient checkbox all types are set to true - not just the client checkbox which is expected.

If I use v-model on the checkboxes directly

`

Client Supplier Manufacturer

`

only selected checkboxes are set to true - which is the desired behaviour - but I got an javascript error in the console because checkbox is trying to update the parent (Cannot read property 'indexOf' of null).

So I see no way to implement this case without javascript error. Any suggestions please?

gswilcox01 commented 6 years ago

Read the docs. Example there works. I think button-group has v-model, then each checkbox has a true-value attribute.

crowincage commented 6 years ago

Of course I've read the (sadly often incomplete) docs @gswilcox01 !

If you've read my question you could see that I'm trying to bind a different model - which simply is not possible in this way. Used a hack.

thanks anyway!