1、单纯取参数值
demo.html
<a routerLink="/notice/notice" [queryParams]="{noticeType: selectedIndex===0?'1':'2'}" target="_blank">更多<i nz-icon nzType="double-right" nzTheme="outline"></i></a>
demo.ts
private routeInfo:ActivatedRoute
this.noticeType = this.routeInfo.snapshot.queryParams['noticeType']
2、函数方式
this.activatedRoute.queryParams
.pipe(
debounceTime(300),
distinctUntilChanged(),
).subscribe(param => {
console.log(param);
this.getProjectInfor(param);
this.selectedIndex = Number(param.indexnumber)
setTimeout(()=>{
this.refreshData(this.selectedIndex === 1?0:null)
},300)
});