nativescript-checkbox icon indicating copy to clipboard operation
nativescript-checkbox copied to clipboard

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

Open jofftiquez opened this issue 7 years ago • 4 comments

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?

jofftiquez avatar Dec 04 '18 04:12 jofftiquez

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".

rigor789 avatar Dec 04 '18 13:12 rigor789

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

jofftiquez avatar Dec 04 '18 15:12 jofftiquez

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

rigor789 avatar Dec 04 '18 16:12 rigor789

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

jofftiquez avatar Dec 04 '18 23:12 jofftiquez