This commit is contained in:
2026-01-14 14:37:42 +08:00
parent c91072f442
commit 7862d37545
8 changed files with 21 additions and 13 deletions

View File

@@ -599,8 +599,13 @@
async handleClick(tab) {
if(tab.label === '自选') {
let item = await this.getFavoriteData();
this.marketList[tab.index].markets = item[0].markets;
this.subscribeAllMarkets()
if(item && item.length > 0) {
this.marketList[tab.index].markets = item[0].markets;
this.subscribeAllMarkets()
} else {
// 没有自选市场,显示空列表
this.marketList[tab.index].markets = [];
}
}else{
this.activeIndex = parseInt(tab.index);
this.subscribeMarkets(this.activeName);
@@ -610,10 +615,13 @@
async getFavoriteData () {
this.userFavorites = [];
let item = await tradeApi.serverFavorite(this.token);
item.data[0].markets.map(v=>{
this.userFavorites.push(v.symbol.toLowerCase());
});
return item.data;
if(item.data && item.data.length > 0 && item.data[0].markets) {
item.data[0].markets.map(v=>{
this.userFavorites.push(v.symbol.toLowerCase());
});
return item.data;
}
return [];
},
isNumber(val) {
var regPos = /^\d+(\.\d+)?$/; //非负浮点数