D
D
Darkness2019-07-09 16:50:23
Vue.js
Darkness, 2019-07-09 16:50:23

Why does inputmask (vue) on iphone drop to the end of the input every time I enter a number?

Why does inputmask (vue) on iphone drop to the end of the input every time I enter a number?
On the android of the norms, on the PC of the norms, on the iphone such a kabard, just throws it off to the end and that's it.

el-form-item(prop="phone")
                el-input(v-model='loginForm.phone', placeholder="+7( )", id="form_phone")

import Inputmask from 'inputmask'
data() {
        var validatePhone = (rule, value, callback) => {
            if (value === '') {
                callback(new Error('Обязательное поле'));
            } else {
                let re = /^(\+7|7|8)?[\s-]?\(?[489][0-9]{2}\)?[\s-]?[0-9]{3}[\s-]?[0-9]{2}[\s-]?[0-9]{2}$/;
                const isTrue =  re.test(value);
                if (!isTrue) {
                    callback(new Error('Неправильный телефон'));
                } else {
                    callback();
                }
            }
        };

 mounted () {
        var im = new Inputmask("+7 (999) 999-99-99");
        im.mask(document.getElementById('form_phone'));
    }

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