1.方法
// 控制底部logou的显示与隐藏
getKeyboardState() {
this.monitorKeyboard = new MonitorKeyboard();
this.monitorKeyboard.onStart();
// 监听虚拟键盘弹出事件
this.monitorKeyboard.onShow(() => {
this.footshow = false;
});
//监听键盘收起的事件
this.monitorKeyboard.onHidden(() => {
this.footshow = true;
});
},离开调用
mounted() {
this.getKeyboardState();
},
beforeDestroy() {
this.monitorKeyboard.onEnd();
},注意:离开页面记得销毁 beforeDestroy
该方法通过创建并使用MonitorKeyboard对象来监听虚拟键盘的状态。在键盘显示时隐藏底部logo,键盘收起时恢复显示。在页面的mounted阶段初始化监听,在beforeDestroy阶段进行销毁,确保资源的释放。
4951

被折叠的 条评论
为什么被折叠?



