number format account profile details

This commit is contained in:
Nolan Lawson 2018-04-03 08:57:01 -07:00
parent 10c34f7cca
commit 3c0fe1effc
1 changed files with 18 additions and 4 deletions

View File

@ -4,7 +4,7 @@
Toots Toots
</span> </span>
<span class="account-profile-details-item-datum"> <span class="account-profile-details-item-datum">
{{account.statuses_count || 0}} {{numStatusesDisplay}}
</span> </span>
</div> </div>
<div class="account-profile-details-item"> <div class="account-profile-details-item">
@ -12,7 +12,7 @@
Follows Follows
</span> </span>
<span class="account-profile-details-item-datum"> <span class="account-profile-details-item-datum">
{{account.following_count || 0}} {{numFollowingDisplay}}
</span> </span>
</div> </div>
<div class="account-profile-details-item"> <div class="account-profile-details-item">
@ -20,7 +20,7 @@
Followers Followers
</span> </span>
<span class="account-profile-details-item-datum"> <span class="account-profile-details-item-datum">
{{account.followers_count || 0}} {{numFollowersDisplay}}
</span> </span>
</div> </div>
</div> </div>
@ -86,3 +86,17 @@
} }
} }
</style> </style>
<script>
const numberFormat = new Intl.NumberFormat('en-US')
export default {
computed: {
numStatuses: account => account.statuses_count || 0,
numFollowing: account => account.following_count || 0,
numFollowers: account => account.followers_count || 0,
numStatusesDisplay: numStatuses => numberFormat.format(numStatuses),
numFollowingDisplay: numFollowing => numberFormat.format(numFollowing),
numFollowersDisplay: numFollowers => numberFormat.format(numFollowers)
}
}
</script>