cordova添加插件

作者: XLsn0w | 来源:发表于2017-04-07 11:40 被阅读264次

    cordova plugin add cordova-plugin-device

    cordova plugin add cordova-plugin-console 

    cordova plugin add cordova-plugin-dialogs

    cordova plugin add cordova-plugin-file

    cordova plugin add cordova-plugin-file-transfer

    cordova plugin add cordova-plugin-camera

    cordova plugin add cordova-plugin-media-capture

    cordova plugin add cordova-plugin-network-information

    cordova plugin add cordova-plugin-splashscreen

    cordova plugin add cordova-plugin-vibration

    cordova plugin add https://github.com/driftyco/ionic-plugins-keyboard


    安装 cordova:

    npm install -g cordova

    创建应用程序

    cordova create xl com.xlsn0w.xl XL

    添加平台

    cordova platform add android

    cordova platform add ios

    完成后运行以下命令查看:

    cordova platfrom list

    移除Android平台支持

    cordova platform rm android

    运行以下命令编译应用程序:

    cordova build

    cordova build android//只针对Andorid平台编译

    实际上build命令相当于以下两个命令:

    cordova prepare android

    cordova compile android

    启动模拟器:

    cordova emulate android

    添加插件:

    可以用CLI搜索可用的插件:

    cordova plugin search bar code

    安装插件,比如:

    cordova plugin add org.apache.cordova.device//设备API

    cordova plugin add org.apache.cordova.network-information//网络(事件)

    cordova plugin add org.apache.cordova.battery-status//电池(事件)

    cordova plugin add org.apache.cordova.device-motion//加速器

    cordova plugin add org.apache.cordova.device-orientation//罗盘

    cordova plugin add org.apache.cordova.geolocation//定位

    cordova plugin add org.apache.cordova.camera//摄像头

    cordova plugin add org.apache.cordova.media-capture//媒体文件处理

    cordova plugin add org.apache.cordova.media//媒体文件处理

    cordova plugin add org.apache.cordova.file//文件访问

    cordova plugin add org.apache.cordova.file-transfer//文件传输

    cordova plugin add org.apache.cordova.dialogs//对话框

    cordova plugin add org.apache.cordova.vibration//震动

    cordova plugin add org.apache.cordova.contacts//联系人

    cordova plugin add org.apache.cordova.globalization//全球化

    cordova plugin add org.apache.cordova.splashscreen//闪屏

    cordova plugin add org.apache.cordova.inappbrowser//打开新的浏览器窗口

    cordova plugin add org.apache.cordova.console//调试控制台

    你可以用以下命令查看所有已经安装的插件

    cordova plugin ls

    使用以下命令删除插件:rm 删除命令

    cordova plugin rm org.apache.cordova.console

    或者通过地址来添加插件:

    cordova plugin add https://github.com/apache/cordova-plugin-console.git

    帮助:

    cordova help

    更新cordova:

    npm update -g cordova

    cordova更新完成后,还需要更新项目:

    cordova platform update android

    相关文章

      网友评论

      • Bury丶冬天:E:\>npm install -g cordova
        npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
        npm ERR! code EINTEGRITY
        npm ERR! sha1-Jw4Gtnsq6UvP7mWS7TnrQjA9GG8= integrity checksum failed when using sha1: wanted sha1-Jw4Gtnsq6UvP7mWS7TnrQjA9GG8= but got sha1-pZQZvb685dOz3Sl1xetS7KpflqU=. (379931 bytes)

        npm ERR! A complete log of this run can be found in:
        npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2017-08-04T02_50_46_704Z-debug.log

      本文标题:cordova添加插件

      本文链接:https://www.haomeiwen.com/subject/irqhattx.html