[bugfix] Tab: return default active when all tabs disabled (#1926)

This commit is contained in:
neverland
2018-10-12 20:03:11 +08:00
committed by GitHub
parent 7e8cb981bc
commit 3d8a2c795f
5 changed files with 23 additions and 36 deletions
+5 -1
View File
@@ -288,14 +288,18 @@ export default create({
}
},
findAvailableTab(index, reverse) {
findAvailableTab(active, reverse) {
const diff = reverse ? -1 : 1;
let index = active;
while (index >= 0 && index < this.tabs.length) {
if (!this.tabs[index].disabled) {
return index;
}
index += diff;
}
return active;
},
// emit event when clicked