【问题标题】:Can I reset ion-content height on button click?我可以在按钮单击时重置离子含量高度吗?
【发布时间】:2017-12-25 14:30:08
【问题描述】:

我可以在按钮单击时重置离子含量滚动高度吗?我需要在按钮单击时切换页脚,但内容高度保持不变

【问题讨论】:

  • 我可以隐藏页脚,但“滚动内容”边距底部没有重置

标签: angular typescript ionic2 ionic3


【解决方案1】:

就像你在Content docs看到的一样:

调整大小()

告诉内容重新计算其尺寸。 这应该 在动态添加/删除页眉、页脚或标签后调用。

import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';

@Component({...})
export class MyPage{
  @ViewChild(Content) content: Content;
  public showFooter: boolean = true;

  hideFooter() {
    this.showFooter = false;
    this.content.resize(); // Tell the content to recalculate its dimensions
  }

  showFooter() {
    this.showFooter = true;
    this.content.resize(); // Tell the content to recalculate its dimensions
  }
}

【讨论】:

    猜你喜欢
    • 2016-10-06
    • 2020-11-04
    • 2022-06-18
    • 1970-01-01
    • 2023-01-30
    • 1970-01-01
    • 2022-11-15
    • 1970-01-01
    • 2021-12-17
    相关资源
    最近更新 更多