提交 8615ec1a 编写于 作者: X xjh22222228

fix(side): top height

上级 b9562f16
......@@ -32,7 +32,8 @@ export default class HomeComponent {
openIndex = queryString().page
contentEl: HTMLElement
searchEngineList = searchEngineList
marginTop: number = searchEngineList.length > 0 ? 70 : 20
marginTop: number = searchEngineList.length > 0 ? 157 : 50
isFirst = false
constructor (private router: Router, private activatedRoute: ActivatedRoute) {}
......@@ -66,6 +67,16 @@ export default class HomeComponent {
ngAfterContentInit() {
window.addEventListener('scroll', this.scroll)
if (!this.isFirst) {
setTimeout(() => {
const headerEl = document.querySelector('.search-header')
if (headerEl) {
this.isFirst = true
this.marginTop = headerEl.clientHeight
}
}, 26)
}
}
ngOnDestroy() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册