-
Notifications
You must be signed in to change notification settings - Fork 34
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
feat(nav): nav support responsive #1273
Conversation
src/nav/nav.component.ts
Outdated
|
||
public moreActive: boolean; | ||
|
||
@ContentChildren(ThyNavLinkDirective, { descendants: true }) tabs: QueryList<ThyNavLinkDirective>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个 tabs 改一个名字,叫 links
或者 navLinks
src/nav/nav.component.ts
Outdated
this.ngZone.onStable.pipe(takeUntil(this.ngUnsubscribe$)).subscribe(() => { | ||
this.calculateMoreIsActive(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方订阅计算更多是否激活是不是太频繁了,使用 ngAfterContentChecked 或者 ngAfterViewChecked 钩子中检查可以吗?
src/nav/nav-link.directive.ts
Outdated
this.width = this.elementRef.nativeElement.offsetWidth; | ||
this.height = this.elementRef.nativeElement.offsetHeight; | ||
this.left = this.elementRef.nativeElement.offsetLeft; | ||
this.top = this.elementRef.nativeElement.offsetTop; | ||
this.content = this.elementRef.nativeElement.outerHTML; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
建议直接使用一个 offset 的 get 访问器返回 width,height,left,top 等数据,不要通过变量保存起来
No description provided.