一、跳转
<a [routerLink]="['/detail']" [queryParams]="{id:id}">跳转detail</a>
二、接受this.route.queryParams
//导入正在显示的路由
import {ActivatedRoute} from '@angular/router'
export class DetailComponent implements OnInit {
//构造函数中配置
constructor(public route:ActivatedRoute) { }
ngOnInit() {
//subscribe触发
this.route.queryParams.subscribe(res=>{
console.log(res)
})
}
}