cleave.js icon indicating copy to clipboard operation
cleave.js copied to clipboard

Model has one more number that mask input

Open leonardotdleal opened this issue 3 years ago • 1 comments

Hello guys,

I'm using cleave.js with Vue.js, but I got a error when I use v-model with numeric mask. The model value has one more number that the input component, like the simulation.

        {
            blocks: [2, 3, 3, 4, 2],
            delimiterLazyShow: true,
            delimiters: ['.', '.', '/', '-'],
            numericOnly: true,
        }

image

Link JSFiddle: https://jsfiddle.net/wbxa59hg/

I' use in web application. :)

leonardotdleal avatar Feb 12 '22 01:02 leonardotdleal

https://github.com/ankurk91/vue-cleave-component/blob/master/src/component.js

This seems to be a Vue issue, not a Cleave.js issue. Hi. I use vue-cleave-component, correctly solves your issue. I debugged the Cleave.js internals and it did not exceed the number of digits in the block.

{{inputValue}} is 111
       new Cleave(this.$refs.input,{
         onValueChanged:function(event){
           console.dir(event.target.value) // 11! But {{inputValue}}} is 111
         },
         blocks: [2],
           delimiterLazyShow: true,
           numericOnly: true,
       })

related to this issue. https://github.com/nosir/cleave.js/issues/630

wafflook avatar Mar 18 '22 03:03 wafflook