hes*_*wky 1 javascript typescript angular
我正在使用ionic 4两种语言构建一个移动应用程序,ar并且en菜单抽屉是一个预构建的组件。
所以我需要刷新抽屉组件以获得基于 dom 方向的正确样式rtl或ltr
我现在所做的只是location.reload重新加载整个应用程序,但我认为这不是一个好的方法
最简单的方法是调用 ngOnInit 类似
fn() {
this.ngOnInit();
}
Run Code Online (Sandbox Code Playgroud)
或者试试这个
this.router.navigateByUrl('/RefreshComponent', { skipLocationChange: true })
.then(() => {
this.router.navigate(['Your actualComponent']);
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12894 次 |
| 最近记录: |