缘由

近日使用uniapp开发微信公众号H5站点,发现首次进入时iPhone x等有刘海屏的会有遮挡,通过查找资料,有个小技巧简单处理

解决办法

// 在 methods 编写下面方法
pushHistory() {
    var state1 = {
    title: title,
    url: '#/'
    };
    window.history.pushState(state1, title, '#/');
}
// 在 onLoad 时执行
this.pushHistory()