N
N
NaN2019-02-07 16:33:58
Vue.js
NaN, 2019-02-07 16:33:58

How to correctly update the value (Imask number)?

I'm trying to set up an input mask using the IMask package. ( https://unmanner.github.io/imaskjs/) Warning appears

Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly.

What is the correct way to update the value?
<input class="form-control"
       id="number-mask"
       type="text"
       autocomplete="off"
       placeholder="0">

import IMask from 'imask';

data () {
        return {
           numberMask     : null,
        };
},

mounted () {
        this.numberMask = new IMask(
            document.getElementById('number-mask'),
            {
                mask              : Number,
                scale             : 2,
                signed            : false,
                thousandsSeparator: ' ',
                radix             : '.',
                mapToRadix        : [','],
                min               : 0,
            },
        );
    },

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-02-07
@KornevaViktoria

Why not use a ready -made component ? It is very likely that your problem has already been solved there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question