[英]Ionic <ion-item> between <ion-label> and <ion-datetime> not showing up
I am trying to make content appear between a stacked ion-label and ion-datetime input, but it just doesn't show up. 我试图使内容出现在堆叠的离子标签和ion-datetime输入之间,但只是没有显示。 What am I doing wrong?
我究竟做错了什么? This is the html code:
这是html代码:
<ion-item>
<ion-label stacked >
<p>Test label</p>
</ion-label>
<ion-item>
<img src="https://www.shorturl.at/img/shorturl-square.png" />
<p class="multiline-text"> Test text </p>
</ion-item>
<ion-datetime displayFormat="MMM D, YYYY" placeholder="MMM D, YYYY"></ion-datetime>
<button large class="transparent-button" style="align-self: flex-start; margin-top:12px;" ion-button item-right (click)="toggleHelp(input)">
<ion-icon style="font-size: 1.7em; align-self: flex-start;" name="ios-help-circle-outline"></ion-icon>
</button>
</ion-item>
I copied and tested your code in one of my projects and the content appears. 我在其中一个项目中复制并测试了您的代码,然后显示内容。
The first thing I noticed is you have an ion-item nested inside another ion-item. 我注意到的第一件事是您在另一个离子项目中嵌套了一个离子项目。 You should close an ion-item before proceeding to next ion-item.
您应该先关闭一个离子项目,然后再进行下一个离子项目。 I would suggest using custom css to build what you are trying to achieve, instead of using ionic UI Components in ways not really intended.
我建议您使用自定义css来构建您要实现的目标,而不是以非真正意图的方式使用离子UI组件。
So after a while of digging through Google searches I found that item-content attribute has to be added to the ion-item. 因此,经过一段时间的Google搜索后,我发现必须将item-content属性添加到离子项目中。 This code works:
此代码有效:
<ion-item>
<ion-label stacked >
<p>Test label</p>
</ion-label>
<ion-item item-content>
<img src="https://www.shorturl.at/img/shorturl-square.png" />
<p class="multiline-text"> Test text </p>
</ion-item>
<ion-datetime displayFormat="MMM D, YYYY" placeholder="MMM D, YYYY"></ion-datetime>
<button large class="transparent-button" style="align-self: flex-start; margin-top:12px;" ion-button item-right (click)="toggleHelp(input)">
<ion-icon style="font-size: 1.7em; align-self: flex-start;" name="ios-help-circle-outline"></ion-icon>
</button>
</ion-item>
https://stackblitz.com/edit/ionic-cmkons?file=pages/home/home.html https://stackblitz.com/edit/ionic-cmkons?file=pages/home/home.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.