hamed-ehtesham / pretty-checkbox-vue

Quickly integrate pretty checkbox components with Vue.js
MIT License
261 stars 31 forks source link

Radio buttons can't have numerical values #4

Closed mstralka closed 6 years ago

mstralka commented 6 years ago

I have a list of radio buttons that I want to render from this list of objects. Note that "id" values are integers:

const items = [
    {id: 1, name: 'Option 1'},
    {id: 2, name: 'Option 2'},
    {id: 3, name: 'Option 3'}
];

If I use the radio button tag:

<p-radio v-for="item in options"
         :key="item.id"
         class="p-default p-fill p-round"
         v-model="form.option"
         :value="item.id"
         color="success"
         required>
    {{ item.name }}
</p-radio>

I get this warning in the console:

[Vue warn]: Invalid prop: type check failed for prop "value". Expected String, got Number.

I think this is because the value prop on the PrettyInput.vue component is typed as a String.

Could the value prop be changed to accept String or Number, or just any value?

Or is there some other way I can use pass integer values to the radio button values?

Thanks Mark

hamed-ehtesham commented 6 years ago

Hi @mstralka,

thank you for using this component and opening this issue to let me know of this problem

i fixed it and value can has any type now, please update to version 1.1.6

mstralka commented 6 years ago

Awesome thanks for fixing it so quickly. This is a great component.