1 跳转
<a [routerLink]="['/detail']" [queryParams]="{id:id}">跳转detail</a>
2 接收 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)
})
}
}