File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -149,6 +149,17 @@ export const useSongMenu = () => {
149149 }
150150 } ;
151151
152+ // 判断两首歌是否相同
153+ const isSameSong = ( song1 : SongType , song2 : SongType ) : boolean => {
154+ if ( song1 . id != null && song2 . id != null ) {
155+ return song1 . id === song2 . id ;
156+ }
157+ if ( song1 . path && song2 . path ) {
158+ return song1 . path === song2 . path ;
159+ }
160+ return false ;
161+ } ;
162+
152163 // 生成菜单选项
153164 const getMenuOptions = (
154165 song : SongType ,
@@ -165,7 +176,7 @@ export const useSongMenu = () => {
165176 const isCloud = router . currentRoute . value . name === "cloud" ;
166177 const isLocal = ! ! song ?. path ;
167178 const isLoginNormal = isLogin ( ) === 1 ;
168- const isCurrent = statusStore . playIndex === index ;
179+ const isCurrent = isSameSong ( musicStore . playSong , song ) ;
169180 const isLocalPlaylist = localStore . isLocalPlaylist ( playListId ) ;
170181 const isUserPlaylist =
171182 ( ! ! playListId && userPlaylistsData . some ( ( pl ) => pl . id === playListId ) ) || isLocalPlaylist ;
You can’t perform that action at this time.
0 commit comments