简体   繁体   English

我可以在单击按钮时重置离子含量高度吗?

[英]Can I reset ion-content height on button click?

Can I reset ion-content scroll height on button click?我可以在单击按钮时重置离子含量滚动高度吗? I need to switch footer on button click, but the content height remains same我需要在单击按钮时切换页脚,但内容高度保持不变

Just like you can see in the Content docs :就像您在内容文档中看到的一样:

resize()调整大小()

Tell the content to recalculate its dimensions.告诉内容重新计算其尺寸。 This should be called after dynamically adding/removing headers, footers, or tabs.这应该在动态添加/删除页眉、页脚或选项卡后调用。

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
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM