未分类

Angular 利用路由跳转到指定页面的指定位置方法_AngularJS_脚本之家

30 3月 , 2020  

app.component.html

app.component.ts

情势二:在原路由地方不变的动静下,利用路由传递参数来完结

You'll see which payment methods are available to you on the checkout page, before you submit a reservation request. After you select your country, all of your payment details will be shown.We charge featured guide who offer journey a 15% service fee. The amount of the service fee is calculated from the price that featured guide set for their journey. You will see the service fee when you set your price before submitting a journey. The service fee is automatically deducted from the payout to the Host. Depending on the laws of the jurisdiction involved, VAT may be charged on top of the service fee. The service fee will include these VAT charges when applicable.

事前做过页面内的跳转,比较容易,近来项目要求落到实处跨页面跳转,并跳转到钦定地点,试了好多措施,有用到传递参数然后让页面滚动相应的相距,不过假诺小说长度产生变化,滚动的间隔也急需再行计算,相比麻烦,所以最终总括出那三种比较可信赖的情势,只须求在急需跳转之处加上适当的id就能够,原理和单页面内跳转相同。

 { path: '',component: LoginComponent}, { path: 'detail', component: DetailComponent }, { path: 'detail#readMore',component: NotFoundComponent}, { path: '**',component: NotFoundComponent}
readMore() {this.router.navigateByUrl; }
ReadMore

app.route.ts

ngOnInit() { if (window.location.hash === '#readMore') { window.location.assign; } }
readMore() { this.router.navigate(['/detail', { id: 'readMore'}]); }detail.component.tsthis.myActivatedRoute.params.subscribe => { if (data.id === 'readMore') { window.location.assign; } } );

detail.component.ts

办法一:新扩展路由地方来促成

上述那篇Angular
利用路由跳转到钦点页面包车型客车内定地点方法就是作者分享给我们的全部内容了,希望能给我们四个参照,也期待大家多都赐教脚本之家。

detail.component.html

app.route.ts

 { path: '',component: LoginComponent}, { path: 'detail', component: DetailComponent }, { path: '**',component: NotFoundComponent}

app.component.ts


相关文章

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图