mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[bugfix] Tab: log error when all tab disabled (#2356)
This commit is contained in:
parent
71555592bb
commit
d77a240a49
@ -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);
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user