简体   繁体   English

离子4 <button ion-item>无法正常显示</button>

[英]Ionic 4 <button ion-item> not showing properly

I'm aiming for a page where there's a searchbar along with a list of items that are clickable. 我的目标是一个带有搜索栏以及可单击项列表的页面。 I've been using the code that's in ionic docs to make it happen but it's not giving me the right result. 我一直在使用离子文档中的代码来实现它,但是它并没有给我正确的结果。 This is the code: 这是代码:

<ion-header>
  <ion-toolbar>
    <ion-title>Page</ion-title>
  </ion-toolbar>
</ion-header>
<ion-searchbar (ionInput)="getItems($event)"></ion-searchbar>
<ion-content>
  <ion-list>
    <button ion-item *ngFor="let item of items" (click)="itemSelected(item)">
      {{ item }}
      </button>  
    </ion-list>
</ion-content>

Yet when I look at it on the app it shows the items like normal buttons, like this: https://puu.sh/BNGId/d21ea0ef34.png 但是,当我在应用程序上查看它时,它显示的项目类似于普通按钮,如下所示: https : //puu.sh/BNGId/d21ea0ef34.png

What am I doing wrong? 我究竟做错了什么?

Edit: I am aiming for it to look like shown here https://ionicframework.com/docs/components/#list-lines 编辑:我的目标是看起来像这里显示https://ionicframework.com/docs/components/#list-lines

Actually solved the issue, it should be: 实际解决了这个问题,应该是:

<ion-item button *ngFor="let item of items" (click)="itemSelected(item)">
  {{ item }}
</ion-item>  

Looks like the folks at Ionic made a mistake? 看起来爱奥尼(Ionic)的人犯了错误?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM