v-money icon indicating copy to clipboard operation
v-money copied to clipboard

Block Negative Numbers

Open lucassmacedo opened this issue 7 years ago • 6 comments

Hello! How i block negative numbers?

lucassmacedo avatar Nov 30 '17 13:11 lucassmacedo

Seems like downgrade to 0.7 is the only way to now

rockylhc avatar Feb 06 '18 10:02 rockylhc

You can prevent '-' key from propagating by adding an event handler to your input element, for example like this:

@keydown="$event.key === '-' ? $event.preventDefault() : null"

loomchild avatar Oct 31 '19 17:10 loomchild

still relevant in 2021

ortonomy avatar Apr 13 '21 06:04 ortonomy

hey @ortonomy, Unfortunately I don't think support will come soon. This repo seems to be abandoned! I decided to upgrade this package to be used with Vue3.

Welcome v-money3!

I'm interested to maintain v-money3 for vue 3 and beyond.

Negatives numbers can be blocked using the disable-negative property on the component. Feel free try it out! Open a issue there if requirements don't meet your expectations.

jonathanpmartins avatar Aug 28 '21 03:08 jonathanpmartins

You can prevent '-' key from propagating by adding an event handler to your input element, for example like this:

@keydown="$event.key === '-' ? $event.preventDefault() : null"

This can lead to false validation cause you can copy/paste a negative value

brunofunnie avatar Nov 23 '21 13:11 brunofunnie

You can prevent '-' key from propagating by adding an event handler to your input element, for example like this:

@keydown="$event.key === '-' ? $event.preventDefault() : null"

This can lead to false validation cause you can copy/paste a negative value

I used this and it disallows copy and pasting

@copy.prevent @paste.prevent

Emmathem avatar Sep 28 '22 22:09 Emmathem