angular - Ionic 2 - 如何重新计算滚动内容和固定内容的边距

标签 angular ionic2 auth0

我在 ionic 2 应用程序中使用 auth0 lock 进行身份验证。经过身份验证后,用户将从登录页面转到主页。锁的配置设置为 closable: false 以在将用户发送到主页之前在后台运行一些代码。

但是,当我回到家时,发现我的 scroll-contentfixed-content 都缺少边距的内联 css。这里也讨论了类似的问题:Using nav.setRoot causes scroll-content to be missing margins for header/footer

有谁知道如何或什么触发 scroll-contentfixed-content 上内联 css 的计算和插入?

如果 auth0 锁定配置具有 autoclose: true,此问题似乎不会出现,但只有在您手动隐藏锁定并进入另一个页面时才会出现。

最佳答案

您可以使用 ion-content 中提供的 resize 方法 - https://ionicframework.com/docs/api/components/content/Content/

您需要做的是:

@ViewChildren(Content) content: Content;

headerUpdated() {
  this.content.resize();
}

调用resize()方法后,fixed-contentscroll-content处的边距将被更新。

关于angular - Ionic 2 - 如何重新计算滚动内容和固定内容的边距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44864926/

相关文章:

angular - 错误错误 : Cannot find control with path

angular - 类型 'value' 上不存在属性 'EventTarget'

android - BLE设备读取特征值的Arraybuffer如何取值

vue.js - Nuxt Auth 模块 - 如何创建成功重定向

javascript - VueJS 通过 Auth0 实现安全 - 它如何安全?

Angular 4 Routing 不适用于实时网络应用程序

javascript - 如何在 Angular 4.4.6 中设置 localStorage 项?

ionic-framework - Ionic2 和 3 地理位置错误 : Only secure origins are allowed, 获取位置时出错并且无法在设备上工作

ios - ionic 构建 ios 成功,但 ionic 构建 ios --release 失败

javascript - Auth0.js : Is there a way to silently replace a google access_token into an auth0 access_token?