[Cordova] 安装 plugin

[Cordova] 安装 plugin


以下以 dialog plugin 为例:

若一般的 alert 不够用的话,可以改用 dialog plugin

navigator.notification.alert(message, alertCallback, [title], [buttonName])


message: 要显示的消息. (String)

alertCallback: 若要在dialog执行完再执行其他的Function时,可将function名称设在这里。. (Function)

title: 窗口标题. (String) (Optional, defaults to Alert)

buttonName: 按钮名称. (String) (Optional, defaults to OK)

安装时要先进到项目所在的数据夹,在底下安装,例如有个 hello项目,就打开cmd,进到 hello 项目底下再执行安装命令。

安装plugin

    $ cordova plugin add org.apache.cordova.dialogs  
    $ cordova plugin add org.apache.cordova.vibration

或是

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git

cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration.git

显示目前安装了哪些plugin
    $ cordova plugin ls
    [ 'org.apache.cordova.dialogs',
      'org.apache.cordova.vibration' ]

移除plugin
    $ cordova plugin rm org.apache.cordova.dialogs
    $ cordova plugin rm org.apache.cordova.vibration

dialog plugin 官网详细资讯:

http://docs.phonegap.com/en/edge/cordova_notification_notification.md.html#notification.alert

原文:大专栏  [Cordova] 安装 plugin


猜你喜欢

转载自www.cnblogs.com/chinatrump/p/11496755.html