【问题标题】:ionic 2 cordova, install cordova plugin typingsionic 2 cordova,安装 cordova 插件类型
【发布时间】:2017-01-14 23:46:12
【问题描述】:

您好,我想为科尔多瓦的 InAppBrowser 安装类型。

使用

typings install dt~cordova --save --global

以某种方式剥离(默认情况下)所有其他引用并且不安装插件。

如何手动安装它们?我试过了

typings install dt~cordova/plugins/InAppBrowser --save --global

是说

无法在注册表中找到“cordova/plugins/InAppBrowser”(“dt”)。

【问题讨论】:

    标签: angular typescript ionic2 typescript-typings


    【解决方案1】:

    你必须安装为typings install dt~cordova/plugins/inappbrowser --global 使用小写作为 "inappbrowser" 而不是 "InAppBrowser"

    【讨论】:

    • 谢谢!你知道为什么 window.cordova.InAppBrowser 不能编译吗?
    • Typescript 无法理解 javascript。所以我们需要安装类型来编译。如果您使用的是 ionic2,那么您可以使用 ionic native 而不是添加类型。
    【解决方案2】:

    使用小写:

    typings install dt~cordova/plugins/inappbrowser --save --global
    

    【讨论】:

      【解决方案3】:

      使用 TypeScript 2.0,您可以使用

      npm install @types/cordova-plugins-inappbrowser --save-dev
      

      见:

      https://github.com/DefinitelyTyped/DefinitelyTyped#definitelytyped-

      【讨论】:

        【解决方案4】:

        在 typescript Ionic 2.2.0 中使用 cordova -----

        npm i -g typings  // update typings, it might needed
        typings install dt~cordova --global --save
        

        然后在 typings/index.d.ts

        中取消注释

        【讨论】:

          猜你喜欢
          • 2020-02-20
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2018-02-23
          • 1970-01-01
          • 2016-02-22
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多