vue-the-mask icon indicating copy to clipboard operation
vue-the-mask copied to clipboard

Ionic 4 VueJs Error

Open marcelo-ribeiro opened this issue 5 years ago • 8 comments

[Vue warn]: Error in directive mask bind hook: "Error: v-mask directive requires 1 input, found 0"

Example: <ion-input v-mask="["##/##/####"]" />

Obs: The mask works fine but have errors in the console.

marcelo-ribeiro avatar Nov 06 '19 19:11 marcelo-ribeiro

could you provide a small reproducible link, maybe in codesand box, if you could it could help the manteiners to work on your problem (maybe even I can help :man_shrugging:)

vhoyer avatar Nov 13 '19 11:11 vhoyer

could you provide a small reproducible link, maybe in codesand box, if you could it could help the manteiners to work on your problem (maybe even I can help 🤷‍♂)

Follow link with demo: https://codesandbox.io/embed/cold-forest-mi8hm?fontsize=14&hidenavigation=1&theme=dark

marcelo-ribeiro avatar Dec 07 '19 11:12 marcelo-ribeiro

sooo, what I think is happening is that the vue-the-mask is loading before the ionic native web components loads, as such, at the time vue-the-mask is evaluating, it is not seem the rendered web component but the <ion-input> with in practice is really not an input, hence the error message you are receiving :/

I'm sorry, I don't know how to help ya tho :/

plus, the manteiners of this project don't mess with this in a long ime :(

vhoyer avatar Dec 10 '19 16:12 vhoyer

I solved this problem by adding hidden vanilla input with mask and same v-model link

<ion-item class="ion-margin-bottom">
  <ion-label position="floating">Телефон</ion-label>
  <ion-input autocapitalize="on" v-model="phone" type="tel" inputmode="tel" placeholder="+7 (___) ___-__-__"></ion-input>
  <input v-mask="'+7 (###) ###-##-##'" v-model="phone" style="display: none">
</ion-item>

flipak180 avatar Feb 07 '21 09:02 flipak180

I solved this issue in my forked repo.

try install

npm install https://github.com/alexcvcoelho/vue-the-mask/archive/refs/tags/v0.11.2.tar.gz

alexcvcoelho avatar Jul 08 '21 16:07 alexcvcoelho

I solved this issue in my forked repo.

try install

npm install https://github.com/alexcvcoelho/vue-the-mask/archive/refs/tags/v0.11.2.tar.gz

How did you solve it?

marcelo-ribeiro avatar Aug 16 '21 18:08 marcelo-ribeiro

I solved this issue in my forked repo. try install

npm install https://github.com/alexcvcoelho/vue-the-mask/archive/refs/tags/v0.11.2.tar.gz

How did you solve it?

I solve in this commit adding this condition on if !el.tagName.toLocaleUpperCase().includes('ION-INPUT') where is done a query selector for input element

alexcvcoelho avatar Aug 16 '21 20:08 alexcvcoelho

I solved this error by installing the package Ionic Vue Input Mask (https://www.npmjs.com/package/ionic-vue-input-mask) It is a fork of Vue The Mask, but fixing the issue forum error.

dominicmonteiro avatar Sep 07 '23 21:09 dominicmonteiro