GithubHelp home page GithubHelp logo

Remove doesnt work on mask chars about v-mask HOT 7 CLOSED

probil avatar probil commented on June 19, 2024
Remove doesnt work on mask chars

from v-mask.

Comments (7)

probil avatar probil commented on June 19, 2024

Hi, @Samuell1
You can delete separating chars right now without any issue.
I don't understand your question. Can you please, explain it deeper?
I'd like to solve the issue you have but I need more information

from v-mask.

Samuell1 avatar Samuell1 commented on June 19, 2024

When I try to delete text AA-####-AAAA and I start deleting using backspace from the last char, deleting stops at AA-####- ...IDK how to explain it better way, I am simply not able to delete that separator (-) without highlighting the whole AA-####-AAAA or moving behind separator with arrows on my keyboard or mouse.

from v-mask.

probil avatar probil commented on June 19, 2024

So, format is: AA-####-AAAA
And you are typing something like: sA-4254-DbtZ
Then you try to delete chars with backspace and you suck at sA-4254-, right?

Btw, what version are you using? For Vue 2.X or Vue 1.X?

from v-mask.

Samuell1 avatar Samuell1 commented on June 19, 2024

I am using Vue 2 and I am using only your function format() in my own custom component on input tag

from v-mask.

probil avatar probil commented on June 19, 2024

So, the issue is not in v-mask. But in your implementation.
Check here how I have solved the issue
In short, I have cached the length. If the previous length is longer then new one I don't call format at all. Because in this case, Backspace/Del was pressed.

Btw, v-mask now supports Vue 2.0

from v-mask.

Samuell1 avatar Samuell1 commented on June 19, 2024

I think i have same function for changing value for input

            var new_value = value

            if (this.mask) {
                var previous = ''

                if (previous.length < value.length) {
                    new_value = this.format(value, this.mask)
                    previous = new_value
                }
            }

            this.currentValue = new_value

from v-mask.

Samuell1 avatar Samuell1 commented on June 19, 2024

I find it! previous.length every time returning 0 :D . I edited it to

            var new_value = value

            if (this.mask) {
                if (this.previousValue.length < value.length) {
                    new_value = this.format(value, this.mask)
                }
                this.previousValue = new_value
            }

            this.currentValue = new_value

from v-mask.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.