【问题标题】:Nativescript 2.2 exceptionNativescript 2.2 异常
【发布时间】:2016-08-11 21:12:34
【问题描述】:

在 2.2 中出现以下异常。

正在使用以前的版本。

做了“tns info”,全部更新到2.2

JS: Error: Uncaught (in promise): EXCEPTION: Error in pages/listview/listview.html:12:2
JS: ORIGINAL EXCEPTION: TypeError: _this.cssClasses(...).set is not a function
JS: ORIGINAL STACKTRACE:
JS: TypeError: _this.cssClasses(...).set is not a function
JS:     at /data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:254:78
JS:     at Array.forEach (native)
JS:     at ViewUtil.setClasses (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:254:17)
JS:     at ViewUtil.setPropertyInternal (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:189:18)
JS:     at ViewUtil.setProperty (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/view-util.js:181:18)
JS:     at NativeScriptRenderer.setElementProperty (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/renderer.js:141:23)
JS:     at NativeScriptRenderer.setElementAttribute (/data/data/org.nativescript.test1/files/app/tns_modules/nativescript-angular/renderer.js:145:21)
JS:     at DebugAppView._View_ListviewPage0.createInternal (ListviewPage.template.js:58:17)
JS:     at DebugAppView.AppView.create (/data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/src/linker/view.js:87:21)
JS:     at DebugAppView.create (/data/data/org.nativescript.test1/files/app/tns_modules/@angular/core/src/linker/view.js:299:44)
JS: ERROR CONTEXT:
JS: [object Object]

【问题讨论】:

    标签: nativescript


    【解决方案1】:

    我用最新的 tns-core-modules 和 nativescript-angular 测试了这个场景,一切都按预期工作。正如@Panayot.Cankov 建议的那样,您应该升级到tns-core-modules@2.2.0nativescript-angular@0.3.0。您可以使用以下命令执行此操作:

    1. tns plugin remove tns-core-modules
    2. tns plugin add tns-core-modules@2.2.0
    3. tns plugin remove nativescript-angular
    4. tns plugin add nativescript-angular@0.3.0

    【讨论】:

      【解决方案2】:

      升级 tns-core-modules@2.2.0 和 nativescript-angular@0.3.0。 经过一些重构后,我们在 tns-core-modules 中的 View 类上引入了 cssClasses Set,但不幸的是,nativescript-angular 正在通过猴子修补 View 类上自己​​的 cssClasses Array 属性来扩展。已解决,但新版本的 tns-core-modules 将与旧版本的 nativescript-angular 不兼容。

      【讨论】:

        【解决方案3】:

        确保你也升级你的角度依赖,我收到同样的错误,直到我碰到 rc4。以下依赖项现在对我有用。

        "@angular/common": "2.0.0-rc.4",
            "@angular/compiler": "2.0.0-rc.4",
            "@angular/core": "2.0.0-rc.4",
            "@angular/http": "2.0.0-rc.4",
            "@angular/platform-browser": "2.0.0-rc.4",
            "@angular/platform-browser-dynamic": "2.0.0-rc.4",
            "@angular/platform-server": "2.0.0-rc.4",
            "@angular/router-deprecated": "2.0.0-rc.2",
            "nativescript-angular": "^0.3.0",
            "nativescript-drop-down": "^1.3.2",
            "rxjs": "5.0.0-beta.6",
            "tns-core-modules": "^2.2.1",
            "zone.js": "^0.6.12"
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 2020-04-27
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-01-15
          相关资源
          最近更新 更多