0
我想使用navigator.app.exitApp();通過對話框退出我的cordova應用程序。我還安裝了cordova對話框插件。navigator.app.exitApp();使用科爾多瓦對話框插件時不起作用
這是我的代碼:
<script>
function onConfirm(buttonIndex) {
alert('You selected button' + buttonIndex);
}
navigator.notification.confirm(
'Do you want to exit app?', // message
onConfirm, // callback to invoke with index of button pressed
'Exit', // title
['Yes','No'] // buttonLabels
);
onConfirm(buttonIndex) {
if (buttonIndex==2){
navigator.app.exitApp();
}
}
</script>
<button onclick="onConfirm(); return false;">Exit</button>
但它不工作。
我該如何解決它?
感謝高級。
它worked.thank你這麼多。 –