我有如下所示的标记。
<ion-item-group>
<ion-item>First</ion-item>
<ion-item>Second</ion-item>
<ion-item>Third</ion-item>
</ion-item-group>
<ion-item-group>
<custom-component></custom-component>
<custom-component></custom-component>
</ion-item-group>
#Custom component markup#
<ion-item>Test<ion-item>问题是,对于我的自定义组件中的离子项,没有绘制标准的底部边框。因为在dom中,它们在自定义组件中。我怎样才能返回底部的边框?
https://stackblitz.com/edit/ionic-7a3ai5?file=app%2Fapp.module.ts。例如,请参见home组件
发布于 2018-09-29 09:06:45
似乎问题在于这些风格规则:
ion-item-group .item-md .item-wrapper:last-child .item-inner,
ion-item-group .item-md:last-child .item-inner {
border: 0;
}
ion-item-group .item-ios:last-child .item-inner,
ion-item-group .item-wrapper:last-child .item-ios .item-inner {
border: 0;
}之所以应用它们,是因为每个custom-component只包含一个项,因此每个项都是其父项的最后一个子项。
解决这一问题的一种方法是手动将Ionic默认边框应用于自定义组件中的每个项(除了最后一个custom-component中的项,就像Ionic一样)。
custom-component {
/* ------- */
/* Android */
/* ------- */
/* Add the border to each item */
.item-md.item-block .item-inner,
ion-item-group .item-md .item-wrapper:last-child .item-inner,
ion-item-group .item-md:last-child .item-inner {
border-bottom: 1px solid #dedede;
}
/* Remove the border from the last custom component item */
&:last-child {
.item-md .item-wrapper:last-child .item-inner,
.item-md:last-child .item-inner {
border: 0;
}
}
/* --- */
/* iOS */
/* --- */
/* Add the border to each item */
.item-ios.item-block .item-inner,
ion-item-group .item-ios:last-child .item-inner,
ion-item-group .item-wrapper:last-child .item-ios .item-inner {
border-bottom: .55px solid #c8c7cc;
}
/* Remove the border from the last custom component item */
&:last-child {
.item-ios:last-child .item-inner,
.item-wrapper:last-child .item-ios .item-inner {
border: 0;
}
}
}https://stackoverflow.com/questions/52565006
复制相似问题