11<script setup lang="ts">
2- import { ref , onMounted , computed , onBeforeUnmount } from ' vue'
2+ import { ref , computed } from ' vue'
33import { marked } from ' marked'
44
55const deviceDropdownRef = ref <HTMLElement | null >(null )
@@ -16,6 +16,7 @@ interface DeviceType {
1616interface DownloadSource {
1717 id: string
1818 name: string
19+ icon: string
1920 description: string
2021 speed: string
2122 contributor? : {
@@ -54,11 +55,11 @@ const baseDeviceTypes: DeviceType[] = [
5455
5556// 下载源定义
5657const downloadSources: DownloadSource [] = [
57- { id: ' github' , name: ' GitHub 源' , description: ' 官方发布渠道' , speed: ' 海外较快' },
58- { id: ' ghfast' , name: ' GitHub 第三方镜像源' , description: ' ghfast.top 加速' , speed: ' 国内较快' },
59- { id: ' ghproxy' , name: ' GitHub 第三方镜像源' , description: ' gh-proxy.com 加速' , speed: ' 国内较快' },
60- { id: ' cloud123' , name: ' 123云盘源' , description: ' 云盘下载页面' , speed: ' 不限速' , contributor: { name: ' lzy98276' , url: ' https://github.com/lzy98276' } },
61- { id: ' cloudreve' , name: ' Cloudreve分流' , description: ' Lotus大佬提供的分流' , speed: ' 稳定快速' , contributor: { name: ' Lotus' , url: ' https://github.com/SummerLotus520/' } }
58+ { id: ' github' , name: ' GitHub 源' , icon: ' /svg/github.svg ' , description: ' 官方发布渠道' , speed: ' 海外较快' },
59+ { id: ' ghfast' , name: ' GitHub 第三方镜像源' , icon: ' /svg/github.svg ' , description: ' ghfast.top 加速' , speed: ' 国内较快' },
60+ { id: ' ghproxy' , name: ' GitHub 第三方镜像源' , icon: ' /svg/github.svg ' , description: ' gh-proxy.com 加速' , speed: ' 国内较快' },
61+ { id: ' cloud123' , name: ' 123云盘源' , icon: ' /123pan.png ' , description: ' 云盘下载页面' , speed: ' 不限速' , contributor: { name: ' lzy98276' , url: ' https://github.com/lzy98276' } },
62+ { id: ' cloudreve' , name: ' Cloudreve分流' , icon: ' /Cloudreve.png ' , description: ' Lotus大佬提供的分流' , speed: ' 稳定快速' , contributor: { name: ' Lotus' , url: ' https://github.com/SummerLotus520/' } }
6263]
6364
6465// 动态设备类型
@@ -272,12 +273,8 @@ onBeforeUnmount(() => {
272273 <span class =" arrow" >▼</span >
273274 </button >
274275 <div class =" dropdown-menu" >
275- <div
276- v-for =" type in dynamicDeviceTypes"
277- :key =" type.id"
278- class =" dropdown-item"
279- @click =" handleVersionChange(type.id)"
280- >
276+ <div v-for =" type in dynamicDeviceTypes" :key =" type.id" class =" dropdown-item"
277+ @click =" handleVersionChange(type.id)" >
281278 <span class =" icon" >{{ type.icon }}</span >
282279 <div class =" item-content" >
283280 <div class =" item-name" >{{ type.name }}</div >
@@ -296,19 +293,17 @@ onBeforeUnmount(() => {
296293 <span class =" arrow" >▼</span >
297294 </button >
298295 <div class =" dropdown-menu" >
299- <div
300- v-for =" source in downloadSources"
301- :key =" source.id"
302- class =" dropdown-item"
303- @click =" selectedDownloadSource = source.id; isSourceDropdownOpen = false"
304- >
296+ <div v-for =" source in downloadSources" :key =" source.id" class =" dropdown-item"
297+ @click =" selectedDownloadSource = source.id; isSourceDropdownOpen = false" >
298+ <img :src =" source.icon" class =" source-icon" alt =" Icon for {{ source.name }}" > <!-- 添加图标显示 -->
305299 <div class =" item-content" >
306300 <div class =" item-name" >{{ source.name }}</div >
307301 <div class =" item-description" >{{ source.description }} · {{ source.speed }}</div >
308302 <div v-if =" source.contributor" class =" contributor" >
309- 由 <a :href =" source.contributor.url" target =" _blank" >{{ source.contributor.name }}</a > 提供
310- <span v-if =" source.id === 'cloudreve'" > · 欢迎进入 <a href =" https://qm.qq.com/q/d4Dd9EOvcI" target =" _blank" >QQ群</a > 了解更多</span >
311- </div >
303+ 由 <a :href =" source.contributor.url" target =" _blank" >{{ source.contributor.name }}</a > 提供
304+ <span v-if =" source.id === 'cloudreve'" > · 欢迎进入 <a href =" https://qm.qq.com/q/d4Dd9EOvcI"
305+ target =" _blank" >QQ群</a > 了解更多</span >
306+ </div >
312307 </div >
313308 </div >
314309 </div >
@@ -353,40 +348,24 @@ onBeforeUnmount(() => {
353348 </div >
354349
355350 <div v-else class =" files" >
356- <div
357- v-for =" file in currentFiles"
358- :key =" file.name"
359- class =" file-item"
360- >
351+ <div v-for =" file in currentFiles" :key =" file.name" class =" file-item" >
361352 <div class =" file-info" >
362353 <span class =" file-icon" >{{ getFileIcon(file.name) }}</span >
363354 <div class =" file-details" >
364355 <div class =" file-name" >{{ file.name }}</div >
365356 <div class =" file-size" >{{ formatFileSize(file.size) }}</div >
366357 </div >
367358 </div >
368- <a
369- :href =" getDownloadUrl(file)"
370- class =" download-button"
371- target =" _blank"
372- v-if =" selectedDownloadSource !== 'cloud123' && selectedDownloadSource !== 'cloudreve'"
373- >
359+ <a :href =" getDownloadUrl(file)" class =" download-button" target =" _blank"
360+ v-if =" selectedDownloadSource !== 'cloud123' && selectedDownloadSource !== 'cloudreve'" >
374361 下载
375362 </a >
376- <a
377- :href =" getDownloadUrl(file)"
378- class =" download-button"
379- target =" _blank"
380- v-else-if =" selectedDownloadSource === 'cloud123'"
381- >
363+ <a :href =" getDownloadUrl(file)" class =" download-button" target =" _blank"
364+ v-else-if =" selectedDownloadSource === 'cloud123'" >
382365 前往下载页面
383366 </a >
384- <a
385- :href =" getDownloadUrl(file)"
386- class =" download-button"
387- target =" _blank"
388- v-else-if =" selectedDownloadSource === 'cloudreve'"
389- >
367+ <a :href =" getDownloadUrl(file)" class =" download-button" target =" _blank"
368+ v-else-if =" selectedDownloadSource === 'cloudreve'" >
390369 前往分流页面
391370 </a >
392371 </div >
@@ -507,6 +486,12 @@ onBeforeUnmount(() => {
507486 background : var (--vp-c-brand-soft );
508487}
509488
489+ .source-icon {
490+ width : 32px ;
491+ height : 32px ;
492+ margin-right : 0.5rem ;
493+ }
494+
510495.icon {
511496 font-size : 1.2rem ;
512497}
0 commit comments