我正在构建一个cordova应用程序,并且我成功地使用了cordova-plugin-ionic-keyboard插件来附加事件监听器,以在键盘显示/隐藏时触发事件。可以使用docs中的示例方法:
window.addEventListener('keyboardWillShow', (event) => {
// Describe your logic which will be run each time when keyboard is about to be shown.
console.log(event.keyboardHeight);
});
window.addEventListener('keyboardWillHide', () => {
// Describe your logic which will be run each time when keyboard is about to be closed.
});
我要开始使用的是能够使用Keyboard.hide();
和Keyboard.show();
方法的功能,但是由于键盘未绑定到窗口而无法使用。我尝试从npm包中导入{Keyboard},但会引发我没有离子帐户访问权限的错误?