【发布时间】:2016-01-25 16:23:22
【问题描述】:
我正在开发 VS2015 和 Apache Cordova 应用程序。我想通过我的应用程序发送电子邮件。我试着做这个,但它对我不起作用。我添加了来自https://github.com/katzer/cordova-plugin-email-composer 的电子邮件 - 作曲家插件
这是我的代码:
<div class="separator-fields"></div><a class="action-button" id="sendemail">Contact Us</a>
这是我的功能:
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/framework.js"></script>
<script>
$("#sendemail") .click(function() {
cordova.plugins.email.open({
to: 'to email',
cc: 'cc email',
bcc: ['bcc email', 'bcc email'],
subject: 'Greetings',
body: 'How are you? Nice greetings from Leipzig'
});
});
</script>
但在我的控制台日志中我有一个错误“未捕获的类型错误:无法读取未定义的属性'插件'”
请指教。
【问题讨论】:
-
控制台有错误吗?
-
不,没有任何错误
-
我已经更新了我的代码,请检查。谢谢
-
"Uncaught TypeError: Cannot read property 'plugins' of undefined" 意味着在您拨打电话时尚未定义 cordova...您在哪里测试了您的应用程序?并且您是否检查过 deviceready 事件是否在调用您的方法之前触发,如here 中所述?
-
我添加了这段代码:document.addEventListener('deviceready', function () { }, false);但错误仍然存在。
标签: cordova jquery-mobile phonegap-plugins cordova-plugins visual-studio-cordova