【问题标题】:Cant complete build in Ionic 2, getting error 'property: does not exist'无法在 Ionic 2 中完成构建,出现错误“属性:不存在”
【发布时间】:2018-03-26 14:08:26
【问题描述】:

我正在尝试使用 Ionic 2 运行 ionic cordova build android,但我收到了一些关于停止构建的错误的编号。不知道为什么,但所有错误都是相似的。

例如下面的result 变量数据来自 API 调用,所以我不知道为什么它会阻止构建运行?

构建错误

[00:45:45]  typescript: C:/xampp/htdocs/apps/test/src/pages/red/red.ts, line: 72
                Property 'game' does not exist on type '{}'.

          L71:  this.gamesProvider.getCurrentGame(user).then((result) => {
          L72:      this.game = result.game;
          L73:      this.hintsAll = result.we;

[00:45:45]  typescript: typescript: C:/xampp/htdocs/apps/test/src/pages/red/red.ts, line: 133
            Property 'status' does not exist on type 'LivegamePage'.

     L132:    // switch icons
     L133:    this.status = false;

【问题讨论】:

    标签: javascript angular ionic-framework ionic2 ionic3


    【解决方案1】:

    是的,这是您构建应用程序时的常见行为。它首先检查打字。因此,转到您的文件打字稿:C:/xampp/htdocs/apps/test/src/pages/red/red.ts并将其更改如下

    this.gamesProvider.getCurrentGame(user).then((result:any) => {
           this.game = result.game;
          this.hintsAll = result.we;
    }
    

    至于其他错误检查你创建了一个变量status

        status:boolean;
            ...
        this.status = false;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-05-27
      • 1970-01-01
      • 2021-09-25
      • 2018-09-06
      • 2019-08-01
      • 2019-12-06
      • 2014-09-01
      相关资源
      最近更新 更多