File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<script setup lang="ts">
22import type { Artist , Track , TrackSource } from " @shared/types/player" ;
33import type { CollectionType } from " @/types/collection" ;
4+ import type { SortField } from " @/types/list" ;
45import { useMediaStore } from " @/stores/media" ;
56import { useStatusStore } from " @/stores/status" ;
67import { useSettingsStore } from " @/stores/settings" ;
@@ -121,24 +122,7 @@ const goAlbum = (item: Track): void => {
121122};
122123
123124/** 排序字段 */
124- type SortField =
125- | " none"
126- | " title"
127- | " artist"
128- | " album"
129- | " path"
130- | " duration"
131- | " size"
132- | " mtime"
133- | " ctime"
134- | " track" ;
135- /** 排序方向 */
136- type SortOrder = " asc" | " desc" ;
137-
138- /** 排序字段 */
139- const sortField = ref <SortField >(" none" );
140- /** 排序方向 */
141- const sortOrder = ref <SortOrder >(" asc" );
125+ const { sortField, sortOrder } = storeToRefs (status );
142126
143127/** 字段文案 key 映射 */
144128const sortFieldLabelKeyMap: Record <SortField , string > = {
Original file line number Diff line number Diff line change @@ -7,7 +7,9 @@ import type {
77} from "@shared/types/player" ;
88import type { Platform } from "@shared/types/platform" ;
99import type { ContentScope } from "@/types/collection" ;
10+ import type { SortField , SortOrder } from "@/types/list" ;
1011export type { RepeatMode , ShuffleMode } from "@shared/types/player" ;
12+ export type { SortField , SortOrder } from "@/types/list" ;
1113import * as queue from "./queue" ;
1214
1315export const useStatusStore = defineStore (
@@ -81,6 +83,10 @@ export const useStatusStore = defineStore(
8183 const likedPageTab = ref < ContentScope > ( "local" ) ;
8284 /** 设置弹窗上次手动选择的大分类 */
8385 const settingsCategory = ref ( "" ) ;
86+ /** 歌曲列表排序字段 */
87+ const sortField = ref < SortField > ( "none" ) ;
88+ /** 歌曲列表排序方向 */
89+ const sortOrder = ref < SortOrder > ( "asc" ) ;
8490 /** 是否正在播放 */
8591 const isPlaying = computed ( ( ) => state . value === "playing" ) ;
8692 /** 是否暂停 */
@@ -136,24 +142,29 @@ export const useStatusStore = defineStore(
136142 myPlaylistSource,
137143 likedPageTab,
138144 settingsCategory,
145+ sortField,
146+ sortOrder,
139147 currentTrack,
140148 showComments,
141149 } ;
142150 } ,
143151 {
144152 persist : {
145153 storage : localStorage ,
146- pick : [
147- "playIndex" ,
148- "repeatMode" ,
149- "shuffleMode" ,
150- "heartMode" ,
151- "volume" ,
152- "position" ,
153- "searchPlatform" ,
154- "myPlaylistSource" ,
155- "likedPageTab" ,
156- "settingsCategory" ,
154+ omit : [
155+ "state" ,
156+ "duration" ,
157+ "currentSource" ,
158+ "outputDevices" ,
159+ "trackLoading" ,
160+ "outerQueueOpen" ,
161+ "fullQueueOpen" ,
162+ "searchOpen" ,
163+ "commentsOpen" ,
164+ "commentsTrack" ,
165+ "autoClose" ,
166+ "abLoop" ,
167+ "lyricOffsetMs" ,
157168 ] ,
158169 } ,
159170 } ,
Original file line number Diff line number Diff line change 1+ /** 歌曲列表排序字段 */
2+ export type SortField =
3+ | "none"
4+ | "title"
5+ | "artist"
6+ | "album"
7+ | "path"
8+ | "duration"
9+ | "size"
10+ | "mtime"
11+ | "ctime"
12+ | "track" ;
13+
14+ /** 歌曲列表排序方向 */
15+ export type SortOrder = "asc" | "desc" ;
You can’t perform that action at this time.
0 commit comments