3

We don't have the decimal type between the possible types to use in the data of a vuejs component (String, Number, Boolean, Array, Object, Date, Function, Symbol), so how to define a variable of this type ?

0

1 Answer 1

3

A decimal variable is of type Number, you could define it as number then use a validator to check if it's decimal :

props:{
 price:{
   type:Number,
   validator(value){
     return value%1!==0
  }
 }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.