Last active
September 15, 2017 19:27
-
-
Save WandersonAlves/e77305a68d8a822e5e6442a7a1351d1a to your computer and use it in GitHub Desktop.
Computed props
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
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