|
95 | 95 | <n-card class="set-item"> |
96 | 96 | <div class="label"> |
97 | 97 | <n-text class="name">缓存大小上限</n-text> |
98 | | - <n-text class="tip" :depth="3">达到上限后将清理最旧的缓存,数值可以是小数,最低 2GB</n-text> |
| 98 | + <n-text class="tip" :depth="3">达到上限后将清理最旧的缓存,可以是小数,最低 2GB</n-text> |
99 | 99 | </div> |
100 | 100 | <n-input-group class="set"> |
101 | 101 | <n-input-number |
|
105 | 105 | :max="9999" |
106 | 106 | :style="{ |
107 | 107 | width: cacheLimited ? '55%' : '0%', |
108 | | - transition: isMounted ? 'width 0.3s ease' : 'none', |
109 | | - }" |
110 | | - @update:value="(value) => { |
111 | | - cacheLimit = value ?? 2; |
112 | | - changeCacheLimit(cacheLimit); |
| 108 | + transition: 'width 0.3s', |
113 | 109 | }" |
| 110 | + @update:value=" |
| 111 | + (value) => { |
| 112 | + cacheLimit = value ?? 2; |
| 113 | + changeCacheLimit(cacheLimit); |
| 114 | + } |
| 115 | + " |
114 | 116 | /> |
115 | 117 | <n-select |
116 | 118 | v-model:value="cacheLimited" |
117 | 119 | :options="[ |
118 | 120 | { label: '不限制', value: 0 }, |
119 | | - { label: cacheLimited === 0 ? '输入数值 (单位 GB)' : 'GB', value: 1 }, |
| 121 | + { label: cacheLimited === 0 ? '自定义大小 (GB)' : 'GB', value: 1 }, |
120 | 122 | ]" |
121 | 123 | :style="{ |
122 | 124 | width: cacheLimited ? '45%' : '100%', |
123 | | - transition: isMounted ? 'width 0.3s ease' : 'none', |
| 125 | + transition: 'width 0.3s', |
124 | 126 | }" |
125 | | - @update:value="(value) => { |
126 | | - if (value === 0) { |
127 | | - changeCacheLimit(0); |
128 | | - } else { |
129 | | - if (cacheLimit === 0) cacheLimit = 2; |
130 | | - changeCacheLimit(cacheLimit); |
| 127 | + @update:value=" |
| 128 | + (value) => { |
| 129 | + if (value === 0) { |
| 130 | + changeCacheLimit(0); |
| 131 | + } else { |
| 132 | + if (cacheLimit === 0) cacheLimit = 2; |
| 133 | + changeCacheLimit(cacheLimit); |
| 134 | + } |
131 | 135 | } |
132 | | - }" |
| 136 | + " |
133 | 137 | /> |
134 | 138 | </n-input-group> |
135 | 139 | </n-card> |
|
158 | 162 | <n-button type="error" strong secondary @click="confirmClearCache"> 清空缓存 </n-button> |
159 | 163 | </n-card> |
160 | 164 | </div> |
161 | | - <div v-if="isDevBuild" class="set-list"> |
| 165 | + <div v-if="statusStore.isDeveloperMode" class="set-list"> |
162 | 166 | <n-h3 prefix="bar"> 下载配置 </n-h3> |
163 | 167 | <n-card class="set-item"> |
164 | 168 | <div class="label"> |
|
309 | 313 | </template> |
310 | 314 |
|
311 | 315 | <script setup lang="ts"> |
312 | | -import { useSettingStore } from "@/stores"; |
| 316 | +import { useSettingStore, useStatusStore } from "@/stores"; |
313 | 317 | import { changeLocalLyricPath, changeLocalMusicPath, formatFileSize } from "@/utils/helper"; |
314 | 318 | import { songLevelData, getSongLevelsData } from "@/utils/meta"; |
315 | 319 | import { useCacheManager, type CacheResourceType } from "@/core/resource/CacheManager"; |
316 | 320 | import { pick } from "lodash-es"; |
317 | | -import { isDevBuild } from "@/utils/env"; |
318 | 321 |
|
| 322 | +const statusStore = useStatusStore(); |
319 | 323 | const settingStore = useSettingStore(); |
320 | 324 | const cacheManager = useCacheManager(); |
321 | 325 |
|
322 | | -const isMounted = ref<boolean>(false); |
323 | | -
|
324 | 326 | const cachePath = ref<string>(""); |
325 | 327 | const cacheSizeDisplay = ref<string>("--"); |
326 | 328 | const cacheLimit = ref<number>(10); // 本地状态 |
@@ -470,7 +472,6 @@ onMounted(async () => { |
470 | 472 | console.error("读取缓存路径失败:", error); |
471 | 473 | } |
472 | 474 | await loadCacheSize(); |
473 | | - isMounted.value = true; |
474 | 475 | }); |
475 | 476 | </script> |
476 | 477 |
|
|
0 commit comments