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