2.0.0 • Published 2 years ago

@mtcmedia/vue-number-input v2.0.0

Weekly downloads
6
License
-
Repository
-
Last release
2 years ago

@mtcmedia/vue-number-input

Install to production site

npm install @mtcmedia/vue-number-input

Usage

import MNumberInput from '@mtcmedia/vue-number-input'
import '@mtcmedia/vue-number-input/dist/MtcNumberInput.css'

Vue.component('MNumberInput', MNumberInput)
<MNumberInput
    :min="18"
>
    <template v-slot:add><i class="fa fa-angle-up"></i></template>
    <template v-slot:subtract><i class="fa fa-angle-down"></i></template>
</MNumberInput>

Props

The component accepts these props:

AttributeTypeDefaultDescription
input-classString''Used to add class to the input field
idString''Add id to input field
nameString''Add name to input field
valueNumber, String0Add initial value to input field on load with v-model on component
minNumber0Set min value for input field
maxNumberInfinitySet max value for input field
autocompleteString''Add autocomplete
readonlyString''Add readonly
disabledString''Add disabled
maxlengthNumber''Add maxlength

Slots

The component accepts these slots:

  • add : Slot to add a custom icon/content for the add button
  • subtract : Slot to add a custom icon/content for the subtract button

Events

The component fires the following events:

AttributeDescription
inputEmits value of input to parent component

To emit event to DOM

// add this line before for legacy js e.g. jQuery
window.vueEventBus = new Vue()

// this as a method on the parent component
emitEvent (value, oldValue) {
    // legacy jquery event - sends event to the DOM
    window.vueEventBus.$emit('numberInput', {
        value: value,
        oldValue: oldValue,
        $el: this.$el
    })
}

Development Setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Run your unit tests

npm run test:unit

Lints and fixes files

npm run lint

Customize configuration

See Configuration Reference.

2.0.0

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.1.0

3 years ago

0.2.0

3 years ago

0.0.0

3 years ago