fix3
This commit is contained in:
@@ -351,10 +351,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 [];
|
||||
},
|
||||
_getDocuments() {
|
||||
homeApi.getDoucments().then(res => {
|
||||
@@ -435,9 +438,18 @@
|
||||
this.$socket.subscribe(this.subscribePath(market), 'market-area');
|
||||
this.$socket.on('market-area', (data) => {
|
||||
// console.log("市场订阅",data.markets)
|
||||
if (data.markets) {
|
||||
let i = this.activeIndex;
|
||||
this.marketList[i].markets = data.markets;
|
||||
try {
|
||||
let markets = data.markets;
|
||||
// 如果是字符串,尝试解析
|
||||
if(typeof markets === 'string') {
|
||||
markets = JSON.parse(markets);
|
||||
}
|
||||
if (markets && Array.isArray(markets)) {
|
||||
let i = this.activeIndex;
|
||||
this.marketList[i].markets = markets;
|
||||
}
|
||||
} catch(e) {
|
||||
console.error('解析市场数据失败:', e, data);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user