Skip to content

Instantly share code, notes, and snippets.

@WandersonAlves
Last active September 15, 2017 19:27
Show Gist options
  • Save WandersonAlves/e77305a68d8a822e5e6442a7a1351d1a to your computer and use it in GitHub Desktop.
Save WandersonAlves/e77305a68d8a822e5e6442a7a1351d1a to your computer and use it in GitHub Desktop.
Computed props
computed: {
strokeDashoffset() {
return DEFAULT_SIZE * (1 - (this.computedPercentage / 100));
},
xAxis() {
if (this.computedPercentage >= 100) {
return TREE_DIGITS_X_AXIS;
} else if (this.computedPercentage >=0 && this.computedPercentage <=9) {
return ONE_DIGITS_X_AXIS;
}
return DEFAULT_DIGITS_X_AXIS;
},
computedDirection() {
if (this.direction !== DIRECTION_MID && this.direction !== DIRECTION_LEFT && this.direction !== DIRECTION_RIGHT) {
return DIRECTION_MID;
}
return this.direction;
},
computedPercentage() {
if (this.percentage > FULL_CIRCLE_PERCENTAGE) {
return FULL_CIRCLE_PERCENTAGE;
} else if (this.percentage < EMPTY_CIRCLE_PERCENTAGE) {
return EMPTY_CIRCLE_PERCENTAGE;
}
return this.percentage;
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment