1.3.2 • Published 11 months ago

v-money-spinner v1.3.2

Weekly downloads
5
License
MIT
Repository
github
Last release
11 months ago

Welcome to V-Money-Spinner

Npm package total downloads GitHub license GitHub release Star on GitHub

V-Money-Spinner for Vue3 is a component which can preset a input spinner with mask currency and style bootstrap, this latter can be disabled.

Notice: Migration Vue2 to Vue3 || I need V-Money-Spinner for Vue2

demo

Demo

Enjoy :smile:

Installation

npm i v-money-spinner
import MoneySpinner from 'v-money-spinner'
app.use(MoneySpinner)

Use

<template>
    <v-money-spinner v-model="amount" v-bind="config"></v-money-spinner>
    {{ amount }}
</template>

<script>
  export default {
    data () {
      return {
        amount: 123.45,
        config: {
          spinner: true,
          step: 10,
          min: -10,
          max: 200,
          prefix: "$ ",
          suffix: " MXN",
          precision: 2,
          decimal: '.',
          thousands: ',',
          template: "bootstrap",
          masked: true,
          disableNegative: false,
          align: "center",
          spinnerAlign: "normal",
        }
      }
    }
  }
</script>

Properties

PropertyTypeDefaultDescription
spinnerBooleantrueApply spinner buttons to the input
stepNumber1Number of steps
precisionNumber2How many decimal places
decimalString"."Decimal separator
thousandsString","Thousands separator
prefixString""Currency symbol followed by a Space, like "R$ "
suffixString""Percentage for example: " %"
minNumbernullThe min value allowed
maxNumbernullThe max value allowed
templateString"bootstrap"Apply template styles, use false if you not need template
maskedBooleanfalseIf the component output should include the mask or not
allowBlankBooleanfalseIf the field can start blank and be cleared out by user
disableNegativeBooleanfalseDon't allow negative values
minCharactersNumber0Minimum number of characters (leading zero)
should-roundBooleanfalseShould default values be rounded or sliced
focus-on-rightBooleanfalseWhen focus, set the cursor to the far right
idString"v-money-spinner"Input id
labelString""Text for label tag
alignString"center"Change by "start" or "end" to align the text in the input

Events

EventParametersDescription
changeunformatted, formatted, old_amountFires when the input value change
plusunformatted, formattedFires when user click on the plus button
minusunformatted, formattedFires when user click on the minus button
positiveunformatted, formatted, old_amountFires when the amount change to positive
negativeunformatted, formatted, old_amountFires when the amount change to negative

Classes (style css)

ClassesDescription
labelClassClass for the label tag
inputClassClass for the input tag
prependClassClass for the left button tag
appendClassClass for the right button tag
wrapperClassClass for div contains all money-spinner
wrapperGroupClassClass for div contains input and the buttons

Migration Vue2 -> Vue3

Summary of changes of the VMoneySpinner files and documentation to help you migrate from Vue2 to Vue3.

New Core

Previously for the use of the VMoneySpinner with Vue2 was used as core the component VMoney by @vuejs-tips, now for Vue3 is used as core VMoney3 by @jonathanpmartins.

Properties

  • Added disableNegative (by core) for block the use of negative numbers.
  • Added minCharacters alias minimumNumberOfCharacters (by core) for insert 0 digit that comes before the first nonzero digit.
  • Breaking Renamed bootstrap to template for the handling different templates though string.
  • Breaking Dropped amend and invalidMessage since the new core does not allow to exceed the properties maximum and minimum.

StyleMinimum number of characters (leading zero)

  • Breaking Change/Update classes (style css) default of Bootstrap 4.6 to Bootstrap 5.1.
  • Breaking Dropped wrapperPrependClass for change in structure of Bootstrap 5.

Events

  • Breaking Dropped exceeded since the new core does not allow to exceed the properties maximum and minimum.

I need for Vue2

Install for Vue2

npm i v-money-spinner@0.1.8

Configuration for Vue2

References

1.3.2

11 months ago

1.3.1

1 year ago

1.3.0

1 year ago

1.2.3

3 years ago

1.2.2

3 years ago

1.2.0

3 years ago

1.2.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago