From c594dc51b23974967fe68968fd74e009ae4a978f Mon Sep 17 00:00:00 2001 From: FireMasterK <20838718+FireMasterK@users.noreply.github.com> Date: Thu, 3 Jun 2021 00:22:58 +0530 Subject: [PATCH] Format numbers with commas. --- src/components/WatchVideo.vue | 6 +++--- src/main.js | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/WatchVideo.vue b/src/components/WatchVideo.vue index 8d1a7845..940467f9 100644 --- a/src/components/WatchVideo.vue +++ b/src/components/WatchVideo.vue @@ -10,14 +10,14 @@
Uploaded on {{ video.uploadDate }} diff --git a/src/main.js b/src/main.js index dcaaf273..e45cdaed 100644 --- a/src/main.js +++ b/src/main.js @@ -49,6 +49,10 @@ const mixin = { } return (num / si[i].value).toFixed(digits).replace(rx, "$1") + si[i].symbol; }, + addCommas(num) { + num = parseInt(num) + return num.toLocaleString('en-US') + }, fetchJson: function (url, options) { return fetch(url, options).then(response => { return response.json();