【发布时间】:2017-06-22 10:49:17
【问题描述】:
TNS v2.5.0
我已将LISTVIEW_DIRECTIVES 导入到我的 app.module 中,我的模板看起来像
<ActionBar title="Events"></ActionBar>
<StackLayout orientation="vertical">
<RadListView [items]="events">
<template tkListItemTemplate let-event="item">
<StackLayout orientation="vertical">
<Image [src]="'https:' + event.image" stretch="aspectFit"></Image>
<Label [nsRouterLink]="['/event', event.id]" [text]="event.title"></Label>
</StackLayout>
</template>
</RadListView>
</StackLayout>
但是这除了更改为常规的 ListView 外什么也没有显示。
如果我尝试GridLayout 喜欢
<ActionBar title="Events"></ActionBar>
<GridLayout>
<RadListView [items]="events">
<template tkListItemTemplate let-event="item">
<StackLayout orientation="vertical">
<Image [src]="'https:' + event.image" stretch="aspectFit"></Image>
<Label [nsRouterLink]="['/event', event.id]" [text]="event.title"></Label>
</StackLayout>
</template>
</RadListView>
</GridLayout>
应用程序因错误而崩溃
file:///app/tns_modules/nativescript-telerik-ui/listview/listview.js:1034:104: JS ERROR TypeError: undefined is not an object (evaluate 'itemViewDimensions.measuredWidth') 2 月 5 日 11:40:53 Marcuss-iMac com.apple.CoreSimulator.SimDevice.1A8C1E25-DAC0-4BA0-822E-5A6F731F1CD7.launchd_sim[31919] (UIKitApplication:org.nativescript.t4g[0x7b2a][36194]): 服务退出 由于分段错误:11
不确定我是否错过了在某处导入某些内容,但文档非常粗略,因此很难确定并查看示例
【问题讨论】:
-
试试
-
没有任何区别
-
有趣的是来自官方 nativescript-ui 存储库的这个示例 (github.com/telerik/nativescript-ui-samples-angular/blob/release/…) 运行良好并且具有相同的 UI 结构。你可以试试看。
-
试过了,但仍然给我错误 file:///app/tns_modules/nativescript-telerik-ui/listview/listview.js:1034:104: JS ERROR TypeError: undefined is not an object (评估“itemViewDimensions.measuredWidth”)
-
在提到的 (github.com/telerik/nativescript-ui-samples-angular) 存储库中使用最新的 2.5.0 版本的 NativeScript 对此进行了测试,没有引发错误。
标签: listview nativescript angular2-nativescript nativescript-telerik-ui