我想实现cordova-plugin-email-composer
。我安装使用cli
未捕获的ReferenceError:要求没有定义
cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git
我得到一个错误Uncaught ReferenceError: require is not defined at email_composer.js:22.
在link u能找到插件的插件。我在我的index.js
文件中添加了以下代码。任何人都可以帮助解决这个问题谢谢。
index.js:
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, function() {
cordova.plugins.email.isAvailable(
function (isAvailable) {
alert("is email mobile available? " + (isAvailable ? "Yes" : "No"));
if(isAvailable){
window.plugin.email.open({
to: '[email protected]',
subject: 'Greetings',
body: 'How are you? Nice greetings from Leipzig'
}, callback, scope);
}
}
);
}, false);
function callback(){
console.log("callback function");
}
function scope(){
console.log("scope function");
}
},
email_composer.js:
var exec = require('cordova/exec'),
isAndroid = navigator.userAgent.toLowerCase().indexOf('android') > -1,
mailto = 'mailto:';
在上面的代码中,我得到一个错误要求不defined.Can任何人帮我解决这个问题? Thankyou。
您使用哪种版本的电子邮件作曲家? – Hiten
版本[email protected] – Anusha
一旦删除插件,将再次添加。你有没有注意到“电子邮件手机可用...”? – Hiten