-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
weui-tabbar中跳转时会触发所有tabs的select事件 #120
Comments
请提供一个可重现示例。 |
我也碰到了这种情况 跳转别的页面 会出发每个tab的select事件 楼主解决了吗 |
@love-YY 我的做法是覆盖原有的指令 import { Directive, OnDestroy } from '@angular/core';
import { BarComponent, TabDirective } from 'ngx-weui';
@Directive({ selector: 'my-weui-tab, [my-weui-tab]' })
export class RWTabDirective extends TabDirective implements OnDestroy {
constructor(tab: BarComponent) {
super(tab);
}
ngOnDestroy(): void {
// 覆盖TabDirective的ngOnDestroy方法
}
} <weui-tabbar>
<my-weui-tab></my-weui-tab>
</weui-tabbar> 这样就不会触发其他事件了 |
为啥我这边输入不能继承 我记得input是可以继承的 |
@love-YY 我的是可以继承,不过我用的是比较旧的1.2.0版本,不清楚会不会是后续版本这个类有改动 |
okay,我用的最新版也可以了。这继承子类还得重新写输入输出 } |
我在一个页面写了一个weui-tabbar包含三个tab,其中第二个tab会在select事件时向后端请求一个耗时1秒多的数据,然后我发现如果我在第一tab的包含的component里执行一个router的跳转,会触发后面所有tab的select事件,这样导致我在第一个tab里所有跳转事件都会先执行第二tab的select事件进行耗时操作再跳转,直接表现就是卡顿非常严重。
经过测试我发现在某个tab内跳转时会顺序向后调用tab的select事件,比如有三个tab(tab1/tab2/tab3),tab1中跳转会调用tab2,tab3的select事件,tab2中跳转就会调用tab3的select事件,tab3中跳转不会调用其余的select事件。
想请问如何能让非tab点击事件时不执行select事件?
我用的是1.1.0版,因为项目中用的angular是^4.0.0版本,你的组件依赖更新得非常激进,我们担心升级依赖会带来不可预料错误,所以如果有什么方法能解决这个问题,请告诉我,而不是让我更新到最新版本,谢谢。
The text was updated successfully, but these errors were encountered: