- 发布:2022-06-21 15:47
- 更新:2022-06-27 17:39
- 阅读:242
产品分类: uniapp/App
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 8
HBuilderX类型: 正式
HBuilderX版本号: 3.4.17
手机系统: 全部
手机厂商: 华为
页面类型: vue
vue版本: vue2
打包方式: 云端
项目创建方式: HBuilderX
测试过的手机:
示例代码:
addEmoji(eid) {
this.editorCtx.insertText({
text: eid,
});
this.fnHideKeyboardTime()
},
deleteEmoji() {
this.editorCtx.undo();
this.fnHideKeyboardTime()
},
fnHideKeyboardTime() {
if (this.hideKeyTime) {
clearInterval(this.hideKeyTime);
}
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
this.hideKeyTime = setInterval(() => {
console.log(7878787)
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
}, 10)
}
addEmoji(eid) {
this.editorCtx.insertText({
text: eid,
});
this.fnHideKeyboardTime()
},
deleteEmoji() {
this.editorCtx.undo();
this.fnHideKeyboardTime()
},
fnHideKeyboardTime() {
if (this.hideKeyTime) {
clearInterval(this.hideKeyTime);
}
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
this.hideKeyTime = setInterval(() => {
console.log(7878787)
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
}, 10)
}
操作步骤:
addEmoji(eid) {
this.editorCtx.insertText({
text: eid,
});
this.fnHideKeyboardTime()
},
deleteEmoji() {
this.editorCtx.undo();
this.fnHideKeyboardTime()
},
fnHideKeyboardTime() {
if (this.hideKeyTime) {
clearInterval(this.hideKeyTime);
}
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
this.hideKeyTime = setInterval(() => {
console.log(7878787)
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
}, 10)
}
addEmoji(eid) {
this.editorCtx.insertText({
text: eid,
});
this.fnHideKeyboardTime()
},
deleteEmoji() {
this.editorCtx.undo();
this.fnHideKeyboardTime()
},
fnHideKeyboardTime() {
if (this.hideKeyTime) {
clearInterval(this.hideKeyTime);
}
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
this.hideKeyTime = setInterval(() => {
console.log(7878787)
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
}, 10)
}
预期结果:
禁止键盘闪动
禁止键盘闪动
实际结果:
键盘必然会出现闪动无法隐藏禁止键盘跳出
键盘必然会出现闪动无法隐藏禁止键盘跳出
bug描述:
this.editorCtx.insertText({
text: eid,
});
插入文本editor出现键盘闪动;
使用
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
setInterval(() => {
uni.hideKeyboard(); //隐藏软键盘
this.editorCtx.blur();
}, 10)
都无法禁止插入表情键盘闪动现象;
具体运行代码请看附件