Skip to content

Remove attribute when v-model.number is empty #5731

@kgrosvenor

Description

@kgrosvenor

What problem does this feature solve?

Solves a design pattern issue, that is of course expected from an MVM flow including v-model.number producing a string when empty.

When i enter a number and then delete the text from input, it turns into a string in the reactive data object.

This is certainly a major usability and casting issue, and i don't see the purpose of keeping an empty string attribute on the model. It should get spliced out of the model when its empty - just as you create new attributes on the text entry, it should be vice versa.

This is certainly a design pattern issue that should be resolved, not needing to be implemented on the application level each time, it's a small fix that will add a lot to VueJS2, and i'm sure many others will agree with me on this!

What does the proposed API look like?

Currently when input is empty

v-model.number="model.number"
model = {
number: ""
}

What it should do when input is empty

v-model.number="model.number"
model = {
}

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