初次默认选中数组最多的tab
initTab: true,
tabs: [],
activeTab: 0,
if (this.initTab) {
let maxUnread = -1;
let activeTabIndex = -1;
for (let i = 0; i < this.tabs.length;i++) {
if (this.tabs[i].unread > maxUnread) {
maxUnread = this.tabs[i].unread;
activeTabIndex = i;
}
}
if (activeTabIndex !== -1) {
this.activeTab = this.tabs[activeTabIndex].label;
}
}
标签:unread,maxUnread,tabs,activeTab,默认,let,tab,选中,activeTabIndex
From: https://blog.51cto.com/u_15694202/7558573