B
B
BonBon Slick2021-06-28 14:48:10
typescript
BonBon Slick, 2021-06-28 14:48:10

Why does @click='setAge(this.age - 1)' throw an isNaN error?

@click='setAge(this.age - 1)'

export default class ModalSelectAge extends Vue implements IUser
{
    @namespace(USER).Getter
    age!:  number;
    @namespace(USER).Action
    setAge!: (age: number) => void;

setAge({commit}, data: number): void {
        console.trace({data});


The question of why the action was entered at all was asked earlier, the validation of the number data type was missed and NaN was placed in the storage.
But why can't you use a setter by passing the getter value + 1 to the parameter?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question