Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Jantho1990
Created August 9, 2018 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jantho1990/7c07807dcb1807d46ebc8ba6efbbf3fe to your computer and use it in GitHub Desktop.
Save Jantho1990/7c07807dcb1807d46ebc8ba6efbbf3fe to your computer and use it in GitHub Desktop.
StarRating Vue -- 9c
<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