From a6138f70f9ae5a1de6e9fae4bbf77d1c1ad3d710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=B9=B3=E8=89=BA?= <52643018@qq.com> Date: Fri, 2 Jul 2021 16:24:09 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BF=AE=E5=A4=8D]=20uview=E6=A1=86=E6=9E=B6?= =?UTF-8?q?=E7=9A=84tabs=E7=BB=84=E4=BB=B6=EF=BC=8C=E5=88=87=E6=8D=A2tab?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uview-ui/components/u-tabs/u-tabs.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uview-ui/components/u-tabs/u-tabs.vue b/uview-ui/components/u-tabs/u-tabs.vue index cd24818..2d83f20 100644 --- a/uview-ui/components/u-tabs/u-tabs.vue +++ b/uview-ui/components/u-tabs/u-tabs.vue @@ -178,7 +178,11 @@ // 后台获取的(如新闻app顶部的菜单),获取返回需要一定时间,所以list变化时,重新获取布局信息 list(n, o) { // list变动时,重制内部索引,否则可能导致超出数组边界的情况 - if(n.length !== o.length) this.currentIndex = 0; + if(n.length !== o.length){ + this.currentIndex = 0; + }else{ + return; + } // 用$nextTick等待视图更新完毕后再计算tab的局部信息,否则可能因为tab还没生成就获取,就会有问题 this.$nextTick(() => { this.init();