nstudio / nativescript-checkbox

NativeScript plugin for checkbox UI component
Other
119 stars 56 forks source link

nativescript-vue - v-model returns object instead of boolean #99

Open jofftiquez opened 5 years ago

jofftiquez commented 5 years ago

Given this example:

<check-box v-model="foo"></check-box>
export default {
  data() {
    return {
      foo: true
    }
  }
}

You can see that the foo was declare as true, but the check-box is not checked. Also if I tapped the checkbox and watched the foo it's value becomes an object with value field inside.

Is there a way to make it emit only a boolean value?

rigor789 commented 5 years ago

This is a bug in nsvue, introduced in 2.0 when we changed to functional components...

I haven't released a fix yet, but as a workaround, you can replace v-model with :checked="foo" @checkedChange="foo = $event.value".

jofftiquez commented 5 years ago

@rigor789 thanks for the workaround. I think this should be mentioned in the docs while the fix is not yet done. Cheers!

rigor789 commented 5 years ago

Absolutely! Would you mind making a PR with the changes to the readme?

jofftiquez commented 5 years ago

@rigor789 I dont mind at all. I will submit a PR then. Thanks :)