jhzh
2024-09-03 6a4dd5834e85c2156b431752d93da487eb9e4a0f
src/page/quotes.vue
@@ -152,8 +152,21 @@
      if (!this.coinList.length) {
        await this.SET_COIN_LIST();
      }
      const coins = this.coinList.map((item) => item.symbol);
      const mainArray = coins.filter((item) => !this.newcoinArr.includes(item));
     const coins = this.coinList.map((item) => item.symbol);
     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));
      const data = await _getHomeList(mainArray.join(","));
      this.tabList[0]["data"] = data.filter((item) =>
        this.myList.includes(item.symbol)