v-numeric

Vue 2.x directive for numeric value restriction of input element.

Usage no npm install needed!

<script type="module">
  import vNumeric from 'https://cdn.skypack.dev/v-numeric';
</script>

README

v-numeric

bundlephobia minified size npm package version github license js standard style

Vue 2.x directive for numeric value restriction of input element.

Install

$ npm i --save v-numeric

Note

  • Support oneway update from an input element to a model.

Usage

import Vue from 'vue'
const numeric = require('v-numeric').default;

Vue.use(numeric)
  • Should use input type="text" instead of "number"
  • Should use custom 'bind' parameter instead of v-model bind
<template>
  <input 
    type="text"
    v-numeric="{ min: 0, max: 100, decimal: 2, bind: 'myData.somedata' }" />
</template>

<script>
...

  myData = {
    somedata = '';
  }

...
</script>