Skip to content

Radio buttons can't have numerical values #4

@mstralka

Description

@mstralka

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions