[bugfix] Tab: log error when all tab disabled (#2356)

This commit is contained in:
neverland 2018-12-22 08:38:54 +08:00 committed by GitHub
parent 71555592bb
commit d77a240a49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -293,7 +293,7 @@ export default create({
this.$nextTick(() => {
const { tabs } = this.$refs;
if (!tabs || this.type !== 'line') {
if (!tabs || !tabs[this.curActive] || this.type !== 'line') {
return;
}
@ -357,14 +357,13 @@ export default create({
scrollIntoView(immediate) {
const { tabs } = this.$refs;
if (!this.scrollable || !tabs) {
if (!this.scrollable || !tabs || !tabs[this.curActive]) {
return;
}
const tab = tabs[this.curActive];
const { nav } = this.$refs;
const { scrollLeft, offsetWidth: navWidth } = nav;
const { offsetLeft, offsetWidth: tabWidth } = tab;
const { offsetLeft, offsetWidth: tabWidth } = tabs[this.curActive];
this.scrollTo(nav, scrollLeft, offsetLeft - (navWidth - tabWidth) / 2, immediate);
},