我想實現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