【问题标题】:ionic 4 side menu doesn't update it's contentionic 4 侧边菜单不更新其内容
【发布时间】:2020-03-07 04:40:41
【问题描述】:

我创建了一个 ionic 4 应用程序。

  • 我正在使用本地谷歌地图和自定义标记。
  • 单击标记时,我想打开包含地点详细信息的侧面菜单。

我做了什么,

- I have disabled the menu at first on app.component.ts
- When ionViewWillEnter() on Map Tab, I have disabled the side-menu
- When ionViewWillLeave() on Map Tab, I have disabled the side-menu
- Side-menu only will enable when to click on the place marker
- I have triggered the event when clicking on place marker
- This event carries the data of place
- I have used the variable 'business' to fill the side-menu
- I have subscribed the event on app.component.ts and assign the 
place data to 'business' variable

问题:-

  • 当我点击标记时,我的侧边菜单没有更新它的内容
  • 当我在标签之间切换时它会更新,我认为是在刷新标签时

【问题讨论】:

    标签: ionic4 side-menu


    【解决方案1】:

    “业务”变量的数据是否更新? 如果是这样,也许您可​​以尝试在 ngzone 中运行分配代码。

    // import zone in your app.component.ts
    import { NgZone } from '@angular/core';
    // add zone provider to the component constructor
      constructor(private zone: NgZone) {
       // ...
      }
    
    // cath click event, then
    this.zone.run(() => { 
    // update data here
    }); 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-19
      • 1970-01-01
      • 1970-01-01
      • 2017-12-25
      相关资源
      最近更新 更多