Skip to content

Possible error in CSelect when using null as option value #83

Closed
@AnReZa

Description

@AnReZa

I'm using the following code:

<CSelect label="Druckername:"
         :options="allPrinters"
         :value.sync="localClientSettings.printerAddress" />
await this.$http.get('Settings/Printers').then(d => {
    // Service returns an array of strings
    const printerList = d.data.map(n => ({ value: n }));
    printerList.unshift({ label: 'Keiner', value: null });
    this.allPrinters = printerList;
});

As soon as I add the "Keiner" entry (which should represent a non-selection), vue writes an error into the console:

vue.esm.js?a026:628 [Vue warn]: Invalid prop: type check failed for prop "value". Expected String, Number, Boolean, Array, got Object

Also, I would expect the value of localClientSettings.printerAddress to be changed to null. Instead it's getting changed to { label: 'Keiner', value: null }, which is the object I've added to my options array.

Why does that happen? Is that a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions