probil / v-mask

🔡 Tiny input mask library for Vue.js (directive)

Home Page:https://v-mask-demo.netlify.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to turn off v-mask for flexible-programmatic use.

sugoidesune opened this issue · comments

commented

I want to set v-mask programmatically. For some input's I need it for others I don't.
It would be great if I could pass v-mask="false" to prevent v-mask from running.

Particular use: I am using a schema to generate forms. I don't think it is possible to set v-mask programmatically, so I need to at least be able to turn it off when not needed.
Example:

form_schema : [
       {
          field: 'Input',
          text: 'Card Number',
          'v-mask': "'####-##-##'",
        },
           {
          field: 'Input',
          text: 'Name',
        //  'v-mask': "false",  // no need to write because default value would be false and v-mask would be turned off for this field
        }
]

Other Solution, but I really don't want to do that:
Setting default to:
v-mask="'X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?X?'"

+1! This functionality would be highly appreciated. I`ll try to sort out a pull request if I get the time.

you can try,

<component
   v-bind="{ 'v-mask': condition && undefined }"
/>

set the value of v-mask to undefined and the directive won't work.