Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Formatters and Parsers #1141

@JosephSilber

Description

@JosephSilber

Is there any way to accomplish in Vue what Formatters and Parsers do in Angular?

If not, would that be a reasonable request?


For a single value you could maybe use a computed property, but that's a single non-reusable transformation. If you want to run the value through a pipeline, well... you can't.

Also, if your value is in a v-repeat, you can't use a computed property anymore; you'll have to create a component for your repeater...

None of that is ideal.


Here's my current use-case: I'm trying to convert this simple online invoice creator from jQuery-spaghetti to Vue. As you can see, the values in the input elements are/should all be formatted as currency, but the underlying model value has to be a number so that you can run your math on them.

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