Reputation: 370
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 ?
Upvotes: 3
Views: 984
Reputation: 1
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
}
}
}
Upvotes: 3