Replace #39;Prompt#39; in on Electron(在 Electron 中替换“提示)
问题描述
如何替换电子中javascript prompt
的功能?
How to replace the function of javascript prompt
in electron?
谁能给我一个例子?
我尝试使用函数prompt
,但报错:
I tried to use the function prompt
, but got an error:
未捕获的错误:prompt() 被支持并且将不被支持.
Uncaught Error: prompt() is and will not be supported.
推荐答案
prompt
, confirm
和 alert
是阻塞执行线程的函数脚本直到用户输入,这就是电子团队不支持它的原因.相反,您可以出于同样的原因使用一些第三方软件包.
prompt
, confirm
and alert
are functions which blocks the execution thread of the script until a user input and that's the reason electron team didn't supported it. Instead you can use some third party package for the same reason.
这里有一些以异步方式提供此功能的包
Here are some packages which provides this functionality in async way
https://www.npmjs.com/package/smalltalk
https://www.npmjs.com/package/vex-js
https://www.npmjs.com/package/dialogs
这篇关于在 Electron 中替换“提示"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Electron 中替换“提示"


基础教程推荐
- 在for循环中使用setTimeout 2022-01-01
- 当用户滚动离开时如何暂停 youtube 嵌入 2022-01-01
- 角度Apollo设置WatchQuery结果为可用变量 2022-01-01
- Karma-Jasmine:如何正确监视 Modal? 2022-01-01
- 动态更新多个选择框 2022-01-01
- 有没有办法使用OpenLayers更改OpenStreetMap中某些要素 2022-09-06
- 我什么时候应该在导入时使用方括号 2022-01-01
- 响应更改 div 大小保持纵横比 2022-01-01
- 在 JS 中获取客户端时区(不是 GMT 偏移量) 2022-01-01
- 悬停时滑动输入并停留几秒钟 2022-01-01