mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(Tab): should not trigger route when disabled (#6782)
This commit is contained in:
parent
d4737ff07e
commit
7a4e47eb09
@ -267,7 +267,7 @@ export default createComponent({
|
|||||||
},
|
},
|
||||||
|
|
||||||
// emit event when clicked
|
// emit event when clicked
|
||||||
onClick(index) {
|
onClick(item, index) {
|
||||||
const { title, disabled, computedName } = this.children[index];
|
const { title, disabled, computedName } = this.children[index];
|
||||||
if (disabled) {
|
if (disabled) {
|
||||||
this.$emit('disabled', computedName, title);
|
this.$emit('disabled', computedName, title);
|
||||||
@ -275,6 +275,7 @@ export default createComponent({
|
|||||||
this.setCurrentIndex(index);
|
this.setCurrentIndex(index);
|
||||||
this.scrollToCurrentContent();
|
this.scrollToCurrentContent();
|
||||||
this.$emit('click', computedName, title);
|
this.$emit('click', computedName, title);
|
||||||
|
route(item.$router, item);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -360,8 +361,7 @@ export default createComponent({
|
|||||||
default: () => item.slots('title'),
|
default: () => item.slots('title'),
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
this.onClick(index);
|
this.onClick(item, index);
|
||||||
route(item.$router, item);
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
));
|
));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user