From 6e1d58964e1cc785c30d8d063bbd133d08120dac Mon Sep 17 00:00:00 2001 From: memorydream <34763046+memorydream@users.noreply.github.com> Date: Thu, 12 May 2022 01:23:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=B8=93=E8=BE=91=E5=88=86=E7=A2=9F?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E9=94=99=E8=AF=AF=20(#1630)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 专辑分碟排序错误 * update --- src/views/album.vue | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/views/album.vue b/src/views/album.vue index f90fa19..a8350df 100644 --- a/src/views/album.vue +++ b/src/views/album.vue @@ -71,12 +71,12 @@ -
-
-

Disc {{ cd }}

+
+
+

Disc {{ item.disc }}

@@ -153,7 +153,7 @@ import locale from '@/locale'; import { splitSoundtrackAlbumTitle, splitAlbumTitle } from '@/utils/common'; import NProgress from 'nprogress'; import { isAccountLoggedIn } from '@/utils/auth'; -import { groupBy } from 'lodash'; +import { groupBy, toPairs, sortBy } from 'lodash'; import ExplicitSymbol from '@/components/ExplicitSymbol.vue'; import ButtonTwoTone from '@/components/ButtonTwoTone.vue'; @@ -222,7 +222,12 @@ export default { } }, tracksByDisc() { - return groupBy(this.tracks, 'cd'); + if (this.tracks.length <= 1) return []; + const pairs = toPairs(groupBy(this.tracks, 'cd')); + return sortBy(pairs, p => p[0]).map(items => ({ + disc: items[0], + tracks: items[1], + })); }, }, created() {