[Vuejs]-How to limits an input to specific values without checking keycodes and without flickering the value?

0👍

we get only numbers

<template>
        <div >
            <input type="text" v-model="data">
            <p> {{ data | number }}</p>

        </div>
    </template>

    <script>

        export default {
        name: 'test',
        data () {
          return {
            data: ''
          }
        },
        filters: {
             number (item) {
                if (!item) { return '' }
                return item.replace(/\D/gm,"");
            }
        }
        }

    </script>

Leave a comment