mirror of
https://github.com/algerkong/AlgerMusicPlayer.git
synced 2026-05-18 03:17:29 +08:00
🐞 fix: 类型问题修复
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// musicHistoryHooks
|
||||
import { useLocalStorage } from '@vueuse/core';
|
||||
|
||||
import type { Song } from '@/type/music';
|
||||
import type { SongResult } from '@/type/music';
|
||||
|
||||
export const useMusicHistory = () => {
|
||||
const musicHistory = useLocalStorage<Song[]>('musicHistory', []);
|
||||
const musicHistory = useLocalStorage<SongResult[]>('musicHistory', []);
|
||||
|
||||
const addMusic = (music: Song) => {
|
||||
const addMusic = (music: SongResult) => {
|
||||
const index = musicHistory.value.findIndex((item) => item.id === music.id);
|
||||
if (index !== -1) {
|
||||
musicHistory.value[index].count = (musicHistory.value[index].count || 0) + 1;
|
||||
@@ -16,7 +16,7 @@ export const useMusicHistory = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const delMusic = (music: Song) => {
|
||||
const delMusic = (music: SongResult) => {
|
||||
const index = musicHistory.value.findIndex((item) => item.id === music.id);
|
||||
if (index !== -1) {
|
||||
musicHistory.value.splice(index, 1);
|
||||
|
||||
Reference in New Issue
Block a user