juareznasato / vuetify-mask

vuetify-mask
27 stars 16 forks source link

mask format for postal code canada #10

Open speedtechj opened 3 years ago

speedtechj commented 3 years ago

How to use mask format for postal code canada exmple t2v2x7

juareznasato commented 3 years ago
I don't know canadian postal code, but you can try it, changing inputMask and outputMask:

<template>
  <div>
    <v-text-field-simplemask
      v-model="value"
      v-bind:label="label"
      v-bind:properties="{
        prefix: '',
        suffix: '',
        readonly: false,
        disabled: false,
        outlined: false,
        clearable: true,
        placeholder: '',
      }"
      v-bind:options="{
        inputMask: '##-####-####-###',
        outputMask: '##-####-####-###',
        empty: null,
        applyAfter: false,
        alphanumeric: true,
        lowerCase: false,
      }"
      v-bind:focus="focus"
      v-on:focus="focus = false"
    />
  </div>
</template>
<script>
export default {
  data: () => ({
    value: "23-A568-B953-356", // "23-A568-B953-356" or "" or null
    label: "Simple Mask",
    focus: false,
  }),
};
</script>
johnrmore commented 3 years ago

If it helps this is a working regular expression got 'go' language Postal Code (^[^DFIOQIWZ][0-9][A-Y]{1}[- ]{0,1}[0-9]{1}[A-Z]{1}[0-9]{1}$)