From d6762cdadf846b59cf3b1ab7b57b864d6d880015 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Wed, 26 May 2021 01:33:18 +0800 Subject: [PATCH] add ',' to player file size --- web/index.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/web/index.js b/web/index.js index 5297288..521c454 100644 --- a/web/index.js +++ b/web/index.js @@ -602,15 +602,14 @@ const component_audio_player = { if (this.playing_file.play_back_type === 'raw') { filesize = this.playing_file.filesize } - if (filesize < 1024 * 1024) { - return filesize - } if (filesize < 1024 * 1024 * 1024) { - return Math.round(filesize / 1024) + 'K' + filesize = Math.round(filesize / 1024) + 'K' } if (filesize < 1024 * 1024 * 1024 * 1024) { - return Math.round(filesize / 1024 / 1024) + 'M' + filesize = Math.round(filesize / 1024 / 1024) + 'M' } + // add separater to number + return filesize.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",") }, computed_playing_audio_file_url() { if (this.playing_file.play_back_type === 'raw') {