fix(player): 修复歌曲时长过长时的进度显示问题 (#1936)

原先进度条遇到时长超过 1hr 的歌曲,
不会呈现小时数的部分。这个 commit
将歌曲时长小时数加到分钟数中。
This commit is contained in:
洩氏诹诹子 2023-04-08 23:16:01 +08:00 committed by GitHub
parent 65f5df8a60
commit b7f7ac8d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 5 deletions

View File

@ -187,6 +187,7 @@ import '@/assets/css/slider.css';
import ButtonIcon from '@/components/ButtonIcon.vue';
import VueSlider from 'vue-slider-component';
import { goToListSource, hasListSource } from '@/utils/playList';
import { formatTrackTime } from '@/utils/common';
export default {
name: 'Player',
@ -239,10 +240,7 @@ export default {
: this.$router.push({ name: 'next' });
},
formatTrackTime(value) {
if (!value) return '';
let min = ~~((value / 60) % 60);
let sec = (~~(value % 60)).toString().padStart(2, '0');
return `${min}:${sec}`;
return formatTrackTime(value);
},
hasList() {
return hasListSource();

View File

@ -221,7 +221,7 @@ export function bytesToSize(bytes) {
export function formatTrackTime(value) {
if (!value) return '';
let min = ~~((value / 60) % 60);
let min = ~~(value / 60);
let sec = (~~(value % 60)).toString().padStart(2, '0');
return `${min}:${sec}`;
}