Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mask for text-field #373

Closed
TolibovMuxammadamin opened this issue Jun 10, 2020 · 2 comments
Closed

mask for text-field #373

TolibovMuxammadamin opened this issue Jun 10, 2020 · 2 comments

Comments

@TolibovMuxammadamin
Copy link

TolibovMuxammadamin commented Jun 10, 2020

I like vuetify and I make application with vuetify, butI want to make a mask for the phone but I can’t, please can turn on the mask for text-field component

@voltyp
Copy link

voltyp commented Dec 24, 2021

Hi, I developed a simple component to use the wonderful imask library with vuetify. The component is based on imask-vue source code. It might be useful to someone. example on codesandbox

@timothyjohnwilson
Copy link

Another simple option is to create a wrapper component for v-text-field
e.g.

<template>
  <v-text-field ref="input" />
</template>

<script>
import IMask from "imask";
export default {
  mounted() {
    IMask(this.$refs.input.$refs.input, {
      mask: Number, // enable number mask
      lazy: false,
      // other options are optional with defaults below
      scale: 2, // digits after point, 0 for integers
      signed: false, // disallow negative
      thousandsSeparator: ",", // any single char
      padFractionalZeros: false, // if true, then pads zeros at end to the length of scale
      normalizeZeros: true, // appends or removes zeros at ends
      radix: ".", // fractional delimiter
      mapToRadix: ["."] // symbols to process as radix

      // additional number interval options (e.g.)
      min: -10000,
      max: 10000
    });
  }
};
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants