在全屏显示和(设置的垂直-水平)设置属性具有此值的情况下更改高度滚动
所以我尝试检测服务订阅角度6设置的属性对象的更改(先前和当前)值
pageService.settingesSubject$.subscribe(data=>{
if(data != undefined){
if(this.settings != undefined){
if(this.settings.menu != data.menu){
data.menu =="horizontal"? this.height -= 56:this.height += 56;
}
}else{
data.menu =="horizontal"? this.height -= 56:null;
}
this.settings=data;
}
})
pageService.isFullScreenSubject$.subscribe(data=>{
if(data != undefined){
if(this.isfirstChangeFullScreen){
data? this.height += 85:null;
}else{
if(this.isFullScreen != data){
data? this.height += 85:this.height -= 85;
}
}
this.isfirstChangeFullScreen= false
this.isFullScreen =data;
}
})
---------
isfirstChangeFullScreen:boolean=true;
isFullScreen:boolean=false;
height:number=465;
@ViewChildren(PerfectScrollbarDirective) pss:
QueryList<PerfectScrollbarDirective>;
@ViewChild('backToTop1') backToTop:any;
public scrollToTop() {
this.pss.forEach(ps =>{
ps.scrollToTop(0,250);
});
}
public onPsScrollY(event){
(event.target.scrollTop > 300) ?
this.backToTop.nativeElement.style.display
= 'flex' : this.backToTop.nativeElement.style.display = 'none';
}
ngAfterViewInit(){
this.backToTop.nativeElement.style.display = 'none';
}
答案 0 :(得分:0)
从父组件发送数据,在构造函数中将其获取