A custom input number component for Vue.js 2.
yarn add vue-input-number --dev
npm install vue-input-number --save-dev
<template>
<input-number
:step="1"
:min="10"
:max="100"
:maxlength="3"
:inputclass="'v-input-number-input'"
@onInputNumberChange="onChange"></input-number>
</template>
<script>
export default {
methods: {
onChange (value) {
console.log(value)
}
}
}
</script>
In your entry app:
const Vue = require('vue')
Vue.component('vue-input-number', require('vue-input-number'))
const app = new Vue({
el: '#app'
})
For more detailed example check out the app directory.
min
is only used as a placeholder if placeholder
is empty.placeholder
has some value then min
is not used as a placeholder.:inputclass="'form-control'"
to use form-control
class in the input element.Event is fired when value is changed.
MIT license
© 2018 José Luis Quintana