打开studio在左侧列表中找到config.xml文件,双击打开,选择插件选项勾选cordova-plugin-dialogs文件,并在权限选项中选择相关权限。最后保存文件。

对话框

summer框架中的联系可以使用cordova插件(cordova-plugin-dialogs),主要功能包含:

1、 对话框1

  1. navigator.notification.prompt('请输入你的名字', // message
  2. onPrompt, // callback to invoke
  3. '注册', // title
  4. ['确定', '退出'], // buttonLabels
  5. 'iuap mobile' // defaultText
  6. );
  7. function onPrompt(results) {
  8. alert("You selected button number " + results.buttonIndex + " and entered " + results.input1);
  9. }

2、对话框2

  1. navigator.notification.alert(
  2. 'You are the winner!', // message
  3. alertDismissed, // callback
  4. 'Game Over', // title
  5. 'Done' // buttonName
  6. );
  7. function alertDismissed() {
  8. alert("ok")
  9. }

3、对话框3

  1. function onConfirm(buttonIndex) {
  2. alert('You selected button ' + buttonIndex);
  3. }
  4. navigator.notification.confirm(
  5. 'You are the winner!', // message
  6. onConfirm, // callback to invoke with index of button pressed
  7. 'Game Over', // title
  8. ['Restart','Exit'] // buttonLabels
  9. );

```
用例github下载地

更多参见

文档更新时间: 2018-01-15 13:57