Skip to content

Commit

Permalink
feat: Added events for keypress up (add) and down (subtract)
Browse files Browse the repository at this point in the history
  • Loading branch information
joserick committed Mar 21, 2023
1 parent 203d13d commit 748c167
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/money_spinner.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<template>
<div :class="style('wrapperClass')">
<label v-if="label" :class="style('labelClass')" :for="id.toString()">
<label v-if="label" :class="style('labelClass')" :for="money?.id">
{{ label }}
</label>
<div :class="style('wrapperGroupClass')">
<button v-if="spinner" type="button" @click="minus"
:class="style('prependClass')">-</button>
<Money v-model="amount.model.value" ref="money" :id="id" v-bind="vAttrs"
<Money v-model="amount.model.value" v-bind="vAttrs"
ref="money" @keydown.up.prevent="plus" @keydown.down.prevent="minus"
:class="[style('inputClass'), template ? 'text-' + align : '']"/>
<button v-if="spinner" type="button" @click="plus"
:class="style('appendClass')">+</button>
Expand Down
2 changes: 0 additions & 2 deletions src/options.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Money, VMoneyOptions } from 'v-money3'

export interface VMoneySpinnerOptions extends VMoneyOptions {
id: string
modelValue: string | number
template: string | boolean
spinner: boolean
Expand All @@ -23,7 +22,6 @@ const defaultsMoney3 = Object.fromEntries(

const defaultOptions: VMoneySpinnerOptions = {
...defaultsMoney3,
id: 'v-money-spinner',
modelValue: 0,
template: 'bootstrap',
spinner: true,
Expand Down
4 changes: 0 additions & 4 deletions src/validations.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import defaults from './options'

export default {
id: {
type: [Number, String],
default: () => defaults.id
},
modelValue: {
type: [Number, String],
default: () => defaults.modelValue
Expand Down

0 comments on commit 748c167

Please sign in to comment.