diff --git a/src/components/trade/trade.vue b/src/components/trade/trade.vue
index b126345..feeecff 100644
--- a/src/components/trade/trade.vue
+++ b/src/components/trade/trade.vue
@@ -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+)?$/; //非负浮点数
diff --git a/web/index.html b/web/index.html
index 319e583..f3771c5 100644
--- a/web/index.html
+++ b/web/index.html
@@ -11,4 +11,4 @@
// hm.src = "https://hm.baidu.com/hm.js?b4837d50cf55e64e8da2130f1ae8e997";
// var s = document.getElementsByTagName("script")[0];
// s.parentNode.insertBefore(hm, s);
-// })();