ui5标签的默认聚合是什么

问题描述 投票:0回答:1

我收到错误消息“如果没有为控件sap.m.Label定义默认聚合,则无法添加直接子级”。不知道这意味着什么。这是我的片段:

<core:FragmentDefinition xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:f="sap.f">
    <ResponsivePopover id="popover" title="{Name}" class="sapUiPopupWithPadding" placement="Bottom">
        <beginButton>
            <Button id="submit" text="{i18n>submit}" press="onSubmit" class="sapUiTinyMargin"/>
        </beginButton>
        <content>
            <f:GridContainer>
                <f:layout>
                    <f:GridContainerSettings rowSize="5rem" columnSize="8rem" gap="1rem"/>
                </f:layout>
                <f:layoutS>
                    <f:GridContainerSettings rowSize="5rem" columnSize="10rem" gap="0.5rem"/>
                </f:layoutS>
                <f:layoutXS>
                    <f:GridContainerSettings rowSize="5rem" columnSize="10rem" gap="0.5rem"/>
                </f:layoutXS>
                <Label text="{i18n>req}" required="true">
                    <f:layoutData>
                        <f:GridContainerItemLayoutData columns="3"/>
                    </f:layoutData>
                </Label>
                <Label id="txt" text="{i18n>cat}" required="true">
                    <f:layoutData>
                        <f:GridContainerItemLayoutData columns="3"/>
                    </f:layoutData>
                </Label>
                <RadioButton id="rbtn1" text="{i18n>grq}">
                    <f:layoutData>
                        <f:GridContainerItemLayoutData columns="4"/>
                    </f:layoutData>
                </RadioButton>
                <RadioButton id="rbtn2" text="{i18n>frq}">
                    <f:layoutData>
                        <f:GridContainerItemLayoutData columns="4"/>
                    </f:layoutData>
                </RadioButton>
                <TextArea id="txtarea" value="" placeholder="{i18n>typeq}" growing="true" growingMaxLines="10" width="100%">
                    <f:layoutData>
                        <f:GridContainerItemLayoutData columns="7"/>
                    </f:layoutData>
                </TextArea>
                <Text text="{i18n>note}">
                    <f:layoutData>
                        <f:GridContainerItemLayoutData columns="7"/>
                    </f:layoutData>
                </Text>
            </f:GridContainer>
        </content>
    </ResponsivePopover>
</core:FragmentDefinition>

预期结果是该片段将正确加载。

sapui5
1个回答
0
投票

sap.m.Label和其他控件不能在sap.f.Gridcontainer内部直接使用。您需要先将它们放置在<f:items>中。

从文档中:https://sapui5.netweaver.ondemand.com/sdk#/api/sap.f.GridContainer%23overview

<f:GridContainer>
  <f:layout>
    <f:GridContainerSettings rowSize="5rem" columnSize="5rem" gap="1rem" />
  </f:layout>
  <f:layoutS>
    <f:GridContainerSettings rowSize="4rem" columnSize="4rem" gap="0.5rem" />
  </f:layoutS>
  <f:items>
    <GenericTile header="Sales Fulfillment">
      <layoutData>
        <f:GridContainerItemLayoutData rows="2" columns="2" />
      </layoutData>
    </GenericTile>
    <w:Card manifest="url-to-manifest">
      <w:layoutData>
        <f:GridContainerItemLayoutData rows="6" columns="3" />
      </w:layoutData>
    </w:Card>
    <Panel>
      <layoutData>
        <f:GridContainerItemLayoutData columns="4" />
      </layoutData>
      <Text text="Sales information" />
    </Panel>
  </f:items>
</f:GridContainer>
© www.soinside.com 2019 - 2024. All rights reserved.