From 6a4dd5834e85c2156b431752d93da487eb9e4a0f Mon Sep 17 00:00:00 2001
From: jhzh <1628036192@qq.com>
Date: Tue, 03 Sep 2024 21:51:31 +0800
Subject: [PATCH] no message

---
 src/page/home.vue |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/src/page/home.vue b/src/page/home.vue
index ce5a9d7..53cf40f 100644
--- a/src/page/home.vue
+++ b/src/page/home.vue
@@ -190,8 +190,26 @@
       // const mainArray = this.coinArr.filter(
       //   (item) => !this.newcoinArr.includes(item)
       // );
+	  
+	  
 	  const coins = this.coinList.map((item) => item.symbol);
-      const mainArray = coins.filter((item) => !this.newcoinArr.includes(item));
+	  
+	  const prioritize = ['btc', 'eth']; // 需要优先排序的币种
+	  
+	  // 按照优先级对 coins 数组进行排序
+	  const sortedCoins = coins.sort((a, b) => {
+	    const aIndex = prioritize.indexOf(a);
+	    const bIndex = prioritize.indexOf(b);
+	  
+	    if (aIndex === -1 && bIndex === -1) return 0; // 两者都不在优先级列表中,不做排序
+	    if (aIndex === -1) return 1; // b 在优先级列表中,a 不在,b 排在前面
+	    if (bIndex === -1) return -1; // a 在优先级列表中,b 不在,a 排在前面
+	    return aIndex - bIndex; // 根据优先级排序
+	  });
+	  
+	  
+      const mainArray = sortedCoins.filter((item) => !this.newcoinArr.includes(item));
+	  console.log(mainArray);
       const list = await _getHomeList(mainArray.join(",")).catch(() => {
         this.timeout = setTimeout(() => {
           this.fetchQList();

--
Gitblit v1.9.3