不显示 GenericTile 中内容的所有内容
Not displayed everything from content in GenericTile
我正在使用 OpenUI5,这是我的代码:
<GenericTile headerText="Header" subheader="Subheader" size="M" frameType="TwoByOne" press="press">
<tileContent>
<TileContent>
<content>
<Title text="Title" />
<NumericContent size="S" scale="M" value="{/para2}" valueColor="Error" indicator="Up" />
<Text text="Text1" />
<Link text="Link" press="viewMore" />
</content>
</TileContent>
</tileContent>
</GenericTile>
我所看到的是:
为什么不显示NumericContent
、Text
和Title
?
我注意到它只显示内容的最后一个元素——这取决于这些元素的顺序。
参考.
简而言之:
发生这种情况是因为 sap.m.TileContent aggregations 中的内容的基数为 0..1,其中 0 是最小基数,1 是最大基数。这意味着内容中只能有一个项目 属性,因此 Tile 将只显示视图中定义的最后一个元素。
您可以通过在磁贴内容中添加 Sap.m.VBox 解决此问题,如下所示:
<GenericTile subheader="Subheader" frameType="TwoByOne" press="press">
<TileContent>
<content>
<VBox>
<Title text="Title"/>
<NumericContent scale="M" value="{/para2}" valueColor="Error" indicator="Up"/>
<Text text="Text1"/>
<Link text="Link" press="viewMore"/>
</VBox>
</content>
</TileContent>
</GenericTile>
虽然我真的建议你不要这样做,而是使用 sap.m.TileContent 上的属性,例如 footer 和unit 您可以在其中向 Tile 插入文本和数字详细信息。
我正在使用 OpenUI5,这是我的代码:
<GenericTile headerText="Header" subheader="Subheader" size="M" frameType="TwoByOne" press="press">
<tileContent>
<TileContent>
<content>
<Title text="Title" />
<NumericContent size="S" scale="M" value="{/para2}" valueColor="Error" indicator="Up" />
<Text text="Text1" />
<Link text="Link" press="viewMore" />
</content>
</TileContent>
</tileContent>
</GenericTile>
我所看到的是:
为什么不显示NumericContent
、Text
和Title
?
我注意到它只显示内容的最后一个元素——这取决于这些元素的顺序。
参考
简而言之: 发生这种情况是因为 sap.m.TileContent aggregations 中的内容的基数为 0..1,其中 0 是最小基数,1 是最大基数。这意味着内容中只能有一个项目 属性,因此 Tile 将只显示视图中定义的最后一个元素。
您可以通过在磁贴内容中添加 Sap.m.VBox 解决此问题,如下所示:
<GenericTile subheader="Subheader" frameType="TwoByOne" press="press">
<TileContent>
<content>
<VBox>
<Title text="Title"/>
<NumericContent scale="M" value="{/para2}" valueColor="Error" indicator="Up"/>
<Text text="Text1"/>
<Link text="Link" press="viewMore"/>
</VBox>
</content>
</TileContent>
</GenericTile>
虽然我真的建议你不要这样做,而是使用 sap.m.TileContent 上的属性,例如 footer 和unit 您可以在其中向 Tile 插入文本和数字详细信息。