File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 133
133
jumpToFile () {
134
134
window .pyobject .eval_emacs_function (" eaf-open-in-file-manager" , [this .currentTrack ]);
135
135
},
136
+
136
137
sortByTitle () {
137
- this .$store .commit (" changeSort" , 0 );
138
+ this .$store .commit (" changeSort" , " title " );
138
139
window .pyobject .eval_emacs_function (" message" , [" Sort by title." ]);
139
140
},
141
+
140
142
sortByArtist () {
141
- this .$store .commit (" changeSort" , 1 );
143
+ this .$store .commit (" changeSort" , " artist " );
142
144
window .pyobject .eval_emacs_function (" message" , [" Sort by artist." ]);
143
145
},
146
+
144
147
sortByAlbum () {
145
- this .$store .commit (" changeSort" , 2 );
148
+ this .$store .commit (" changeSort" , " album " );
146
149
window .pyobject .eval_emacs_function (" message" , [" Sort by album." ]);
147
150
}
148
151
}
Original file line number Diff line number Diff line change @@ -32,22 +32,17 @@ const store = new Vuex.Store({
32
32
state . fileInfos = infos ;
33
33
state . numberWidth = state . fileInfos . length . toString ( ) . length ;
34
34
} ,
35
- /*
36
- * 0 : sort by name
37
- * 1 : sort by artist
38
- * 2 : sort by album
39
- */
40
- changeSort ( state , selectIndex ) {
35
+ changeSort ( state , compareType ) {
41
36
var currentSong = state . fileInfos [ state . currentTrackIndex ] ;
42
37
state . fileInfos . sort ( function ( a , b ) {
43
38
var compareA , compareB ;
44
- if ( selectIndex === 0 ) {
39
+ if ( compareType === "title" ) {
45
40
compareA = a . name ;
46
41
compareB = b . name ;
47
- } else if ( selectIndex === 1 ) {
42
+ } else if ( compareType === "artist" ) {
48
43
compareA = a . artist ;
49
44
compareB = b . artist ;
50
- } else {
45
+ } else if ( compareType === "album" ) {
51
46
compareA = a . album ;
52
47
compareB = b . album ;
53
48
}
You can’t perform that action at this time.
0 commit comments