修复音乐页热门与最新分类筛选不生效
This commit is contained in:
@@ -38,9 +38,16 @@ const getMusicTypeId = (music) => {
|
||||
|
||||
const applyMusicFilter = (list = []) => {
|
||||
const normalizedKeyword = keyword.value.trim().toLowerCase()
|
||||
const selectedTypeItem = musicTypes.value.find(item => item.id === selectedType.value)
|
||||
const selectedTypeName = selectedTypeItem?.name || ''
|
||||
|
||||
return list.filter((music) => {
|
||||
const matchType = selectedType.value == null || getMusicTypeId(music) === selectedType.value
|
||||
const musicTypeId = getMusicTypeId(music)
|
||||
const musicTypeName = music?.typeName || music?.type?.name || ''
|
||||
|
||||
const matchType = selectedType.value == null
|
||||
|| (musicTypeId != null && Number(musicTypeId) === Number(selectedType.value))
|
||||
|| (musicTypeId == null && selectedTypeName && musicTypeName === selectedTypeName)
|
||||
|
||||
if (!normalizedKeyword) {
|
||||
return matchType
|
||||
@@ -48,7 +55,7 @@ const applyMusicFilter = (list = []) => {
|
||||
|
||||
const searchText = [
|
||||
music.name,
|
||||
music.typeName,
|
||||
musicTypeName,
|
||||
music.album,
|
||||
music.singer,
|
||||
...(Array.isArray(music.singerNames) ? music.singerNames : [])
|
||||
|
||||
Reference in New Issue
Block a user