我为 iOS、Android 和 Web (PWA) 制作了一个自定义电容器插件,但是当我在浏览器中打开基于电容器的应用程序时,我收到以下错误消息:
ERROR Error: Uncaught (in promise): MyPlugin does not have web implementation.
所以问题是 Capacitor 没有找到插件的 Web 实现。
最佳答案
我在运行 Capacitor v2.4.7 时遇到了这个问题。它似乎是由 Plugins
对象的解构引起的:
const {MyPlugin} = Plugins;
MyPlugin.myMethod(); // FAIL
我发现使用Plugins
对象直接避免了错误:
Plugins.MyPlugin.myMethod(); // OK
来源:https://github.com/ionic-team/capacitor/issues/749#issuecomment-479781137
关于ios - 错误 错误 : Uncaught (in promise): MyPlugin does not have web implementation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58074649/