刚开始看 cocoonjs 并使用启动器应用程序尝试了他们教程中的画布演示。我想知道是否有办法在打开应用程序时在移动设备上调出软键盘(屏幕上没有文本输入,或者也许有一个隐藏的)?
问问题
284 次
1 回答
2
If you are using the newest launcher and lib, you should be able to do that via this code:
Cocoon.Dialog.showKeyboard({
type : Cocoon.Dialog.keyboardType.TEXT,
},{
insertText: function(inserted) { text+= inserted; console.log(text);},
deleteBackward: function() {text = text.slice(0, text.length -1); console.log(text);},
done : function(){ console.log("user clicked done key") },
cancel : function(){ console.log("user dismissed keyboard") }
});
You can then hide the keyboard via this code:
Cocoon.Dialog.dismissKeyboard();
If you get an error that "deleteBackward" is undefined, go to the cocoon.js file search for this line:
[params, insertCallback, deleteBackward, doneCallback, cancelCallback], true);
and replace it with this one:
[params, insertCallback, deleteCallback, doneCallback, cancelCallback], true);
于 2014-11-23T19:01:11.163 回答