NativeScript 错误.在列表模板中找到多个视图 [英] NativeScript error. More than one view found in list template

查看:22
本文介绍了NativeScript 错误.在列表模板中找到多个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的 ListView

I had such ListView

<ListView [items]="groceryList" row="1" class="small-spacing" [class.visible]="listLoaded">
    <template let-item="item" columns="*, auto" >
      <Label [text]="item.name" class="medium-spacing"></Label>      
    </template>
  </ListView>

我想添加图片按钮.所以我只是将 columns="*, auto" 添加到 templatecol="0" 到标签和 col="1" 到我的 Image

I want to add image button. So I just added columns="*, auto" to template and col="0" to Label and col="1" to my Image

 <ListView [items]="groceryList" row="1" class="small-spacing" [class.visible]="listLoaded">
    <template let-item="item" columns="*, auto" >
      <Label [text]="item.name" class="medium-spacing" col="0"></Label>
      <Image src="res://delete" (tap)="delete(item.id)" col="1"></Image>      
    </template>
  </ListView>

运行模拟器后出现错误:

After running an emulator I am getting an error:

任何想法为什么会发生这种情况以及如何解决?

Any thoughts why is that happening and how to fix that?

推荐答案