3 years ago

Problem with v-show

Posted 3 years ago by NightM4re

I want to show a message warning when the quantity that one people want to buy of some product is more bigger than my quantity available of that product. I am doing this with this line of code

<p v-show="Stock(product.cantidad, product.product.cantidad)" style="color:#ff6a00">No hay suficiente Stock</p>

and my function Stock is

Stock: function(cantidad, existe){
            if(cantidad > existe){
                return true
            return false

The problem is when existe variable is 5 and cantidad variable 6, return true and always is ok, but if cantidad variable is 10 return true again, this mean 6 > 5 is true (correct) 6 > 8 is false (correct) 6 > 10 is true (incorrect) and go on until 6> 59 is true (incorrect) 6> 61 is false (correct)

Is like 6 is greater than 10 because then represent only 1 and not then. Please help because I don't know how to solve this

Please sign in or create an account to participate in this conversation.