From 6ea006006f3eb79309f827a331131745c2b495f3 Mon Sep 17 00:00:00 2001 From: Waiter Date: Fri, 14 Feb 2020 15:19:02 +0800 Subject: [PATCH] fix(Tabs): fix disabled event data (#2758) --- packages/tabs/index.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/tabs/index.ts b/packages/tabs/index.ts index 79c99a73..f594a1f6 100644 --- a/packages/tabs/index.ts +++ b/packages/tabs/index.ts @@ -137,19 +137,19 @@ VantComponent({ this.setCurrentIndexByName(this.getCurrentName() || data.active); }, - trigger(eventName: string) { + trigger(eventName: string, child?: TrivialInstance) { const { currentIndex } = this.data; - const child = this.children[currentIndex]; + const currentChild = child || this.children[currentIndex]; - if (!isDef(child)) { + if (!isDef(currentChild)) { return; } this.$emit(eventName, { - index: currentIndex, - name: child.getComputedName(), - title: child.data.title + index: currentChild.index, + name: currentChild.getComputedName(), + title: currentChild.data.title }); }, @@ -158,7 +158,7 @@ VantComponent({ const child = this.children[index]; if (child.data.disabled) { - this.trigger('disabled'); + this.trigger('disabled', child); } else { this.setCurrentIndex(index); wx.nextTick(() => {