mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-05-21 22:09:16 +08:00
fix(Tabs): fix disabled event data (#2758)
This commit is contained in:
parent
438d97eca3
commit
6ea006006f
@ -137,19 +137,19 @@ VantComponent({
|
|||||||
this.setCurrentIndexByName(this.getCurrentName() || data.active);
|
this.setCurrentIndexByName(this.getCurrentName() || data.active);
|
||||||
},
|
},
|
||||||
|
|
||||||
trigger(eventName: string) {
|
trigger(eventName: string, child?: TrivialInstance) {
|
||||||
const { currentIndex } = this.data;
|
const { currentIndex } = this.data;
|
||||||
|
|
||||||
const child = this.children[currentIndex];
|
const currentChild = child || this.children[currentIndex];
|
||||||
|
|
||||||
if (!isDef(child)) {
|
if (!isDef(currentChild)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$emit(eventName, {
|
this.$emit(eventName, {
|
||||||
index: currentIndex,
|
index: currentChild.index,
|
||||||
name: child.getComputedName(),
|
name: currentChild.getComputedName(),
|
||||||
title: child.data.title
|
title: currentChild.data.title
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ VantComponent({
|
|||||||
const child = this.children[index];
|
const child = this.children[index];
|
||||||
|
|
||||||
if (child.data.disabled) {
|
if (child.data.disabled) {
|
||||||
this.trigger('disabled');
|
this.trigger('disabled', child);
|
||||||
} else {
|
} else {
|
||||||
this.setCurrentIndex(index);
|
this.setCurrentIndex(index);
|
||||||
wx.nextTick(() => {
|
wx.nextTick(() => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user