9797 <h4 >搜索源</h4 >
9898 <span class =" sources-count" >({{ searchStats.completed }}/{{ searchStats.total }})</span >
9999 <span class =" sources-result-tag" v-if =" searchStats.withData > 0" >{{ searchStats.withData }}</span >
100+ <span class =" sources-time-tag" v-if =" searchTotalTime > 0" >{{ searchTotalTime.toFixed(2) }}s</span >
100101 </div >
101102 <div class =" sources-list" >
102103 <div
@@ -336,6 +337,10 @@ export default defineComponent({
336337 // 搜索完成时间戳记录
337338 const searchCompletedTimes = ref ({}); // 记录每个源完成搜索的时间戳
338339
340+ // 搜索耗时记录
341+ const searchStartTime = ref (0 ); // 搜索开始时间戳
342+ const searchTotalTime = ref (0 ); // 搜索总耗时(秒)
343+
339344 // ActionRenderer相关
340345 const showActionRenderer = ref (false );
341346 const currentActionData = ref (null );
@@ -500,6 +505,9 @@ export default defineComponent({
500505 const trimmedKeyword = keyword .trim ();
501506 console .log (' 🔍 [performSearch] 开始执行搜索:' , { trimmedKeyword });
502507
508+ // 记录搜索开始时间
509+ searchStartTime .value = Date .now ();
510+
503511 searchKeyword .value = trimmedKeyword;
504512 hasSearched .value = true ;
505513
@@ -511,6 +519,7 @@ export default defineComponent({
511519 currentPages .value = {};
512520 hasMorePages .value = {};
513521 searchCompletedTimes .value = {}; // 清空搜索完成时间戳
522+ searchTotalTime .value = 0 ; // 重置搜索总耗时
514523 displayedCount .value = pageSize .value ;
515524
516525 console .log (' 🔍 [performSearch] 状态重置完成:' , {
@@ -528,6 +537,12 @@ export default defineComponent({
528537 );
529538
530539 await Promise .allSettled (searchPromises);
540+
541+ // 计算搜索总耗时
542+ const searchEndTime = Date .now ();
543+ searchTotalTime .value = (searchEndTime - searchStartTime .value ) / 1000 ; // 转换为秒
544+ console .log (' 🔍 [performSearch] 搜索完成,总耗时:' , searchTotalTime .value .toFixed (2 ) + ' s' );
545+
531546 // 记录最近搜索
532547 try {
533548 const HISTORY_KEY = ' drplayer_search_history' ;
@@ -1318,6 +1333,7 @@ export default defineComponent({
13181333 showActionRenderer,
13191334 currentActionData,
13201335 searchStats,
1336+ searchTotalTime,
13211337 performSearch,
13221338 selectSource,
13231339 getSourceName,
@@ -1540,6 +1556,16 @@ export default defineComponent({
15401556 margin- left: 8px ;
15411557}
15421558
1559+ .sources - time- tag {
1560+ background: #1890ff ;
1561+ color: white;
1562+ font- size: 12px ;
1563+ padding: 2px 8px ;
1564+ border- radius: 12px ;
1565+ font- weight: 500 ;
1566+ margin- left: 8px ;
1567+ }
1568+
15431569.sources - list {
15441570 flex: 1 ;
15451571 overflow- y: auto;
0 commit comments