Search code examples
vue.jsquasar

how to accept only four number in q-input in quasar?


i want to acccept only four number in <q-input/> in quasar

  <q-input dense type="number" class="q-mx-lg q-mb-lg"  :input-style="{ fontSize:'30px',letterSpacing: '25px',textAlign:'center' }"  v-model="pin" style="width: 40%; border: none; border-bottom: 2px solid #B157AE;"/>

using :rules="[]" wont solve it


Solution

  • Just found out there is maxlength in q-input api

    maxlength="4"
    

    do the trick

    <q-input class="q-mx-md" style="width: 20%;" maxlength="4"  :input-style="{letterSpacing:'50px'}" dense square filled  v-model="emailCode" />