wirecardBrasil / awesome-mask

The awesome-mask runs with Vue.js and uses the vanilla-masker to make your form awesome with masks.
MIT License
165 stars 22 forks source link

Pasting in input without updating data in Vuejs #11

Closed joohncruz closed 7 years ago

joohncruz commented 7 years ago

I am having problems when the user paste the value of the field(ctrl + v). The field fullfil the mask correctly, but the element in the data property in vuejs stays without the mask. Have you been through this?

Code:

import AwesomeMask from 'awesome-mask'

Vue.directive('mask', AwesomeMask);

new Vue ({
    el: '#inicialEmail',
    data: {
        action: '',
        requestType: '',
        inscricao: {
            nomcan: '',
            emailcan: '',
            celcan: ''
        }
    })

Example:

Copy paste:

image

Write:

image

caioincau commented 7 years ago

Are you using which event on the template? Have you tried to get the value after Vue.nextTick?

caioincau commented 7 years ago

@JoohnCruz

joohncruz commented 7 years ago

@iCaio i will try to use the Vue.nextTick,

I just tried to use, important and as directive.

Example:

` import AwesomeMask from 'awesome-mask'

Vue.directive('mask', AwesomeMask); `

<input name="cpfcan" id="cpfcan" v-model="inscricao.cpfcan" v-mask="'999.999.999-99'">

No event is intended for this.

caioincau commented 7 years ago

After some hours looking for it, I found this: https://github.com/vuejs/vue/issues/2804

This is related to this Vue issue.

I think I have fixed it on version 0.4.2, can you try it @JoohnCruz ?

caioincau commented 7 years ago

Issue closed due one week or ore of inactivity