Created
August 9, 2018 01:35
-
-
Save Jantho1990/7c07807dcb1807d46ebc8ba6efbbf3fe to your computer and use it in GitHub Desktop.
StarRating Vue -- 9c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import ratingIsValid from '../lib/validate' | |
// ... | |
export default { | |
// ... | |
beforeMount () { | |
let {rating, minRating, maxRating, starRatio, limit} = this | |
if (!ratingIsValid(rating, minRating, maxRating, starRatio, limit)) { | |
throw new Error( | |
`Illegal rating values detected. You should check your initial App state. (rating: ${rating}, minRating: ${minRating}, maxRating: ${maxRating}, starRatio: ${starRatio}, limit: ${limit})` | |
) | |
} | |
}, | |
// ... | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment