在运行时创建或添加节内容

时间:2019-05-27 09:17:41

标签: apache-royale

我想在运行时添加/创建节内容。我看到了来自tour de jewel mainContent.mxml的示例,但似乎是应用程序启动时所有部分内容都已加载。

我只想在需要时加载节内容,而在应用程序启动时根本不加载。

因此,当各个部分的内容有更新时,我们不需要刷新浏览器。

<j:ApplicationMainContent localId="main" hasTopAppBar="true" hasFooterBar="true" selectedContent = "welcome_panel">
    <local:WelcomeSection name="welcome_panel"/>
    <local:AlertPlayGround name="alert_panel"/>
    <local:ButtonPlayGround name="button_panel"/>
    <local:ImagePlayGround name="image_panel"/>
    <local:NumericStepperPlayGround name="numericstepper_panel"/>
    <local:DateComponentsPlayGround name="datecomponents_panel"/>
    <local:ComboBoxPlayGround name="combobox_panel"/>
    <local:CheckBoxPlayGround name="checkbox_panel"/>
    <local:MiscelaneaPlayGound name="miscelanea_panel"/>
    <local:HeadingsAndText name="text_panel"/>
    <local:LabelPlayGround name="label_panel"/>
    <local:ListPlayGround name="list_panel"/>
    <local:RadioButtonPlayGround name="radiobutton_panel"/>
    <local:SliderPlayGround name="slider_panel"/>
    <local:TextInputPlayGround name="textinput_panel"/>
    <local:GridPlayGround name="grid_panel"/>
    <local:CardPlayGround name="card_panel"/>
    <local:TablePlayGround name="tables_panel"/>
    <local:FormsValidationPlayGround name="form_validation_panel"/>
    <local:DropDownListPlayGround name="dropdownlist_panel"/>
    <local:SnackbarPlayGround name="snackbar_panel"/>
    <local:TabBarPlayGround name="tabbar_panel"/>
    <local:ViewStatesPlayGround name="viewstates_panel"/>
    <local:LayoutsPlayGround name="layouts_panel"/>
    <local:WizardPlayGround name="wizards_panel"/>
    <local:PopUpPlayGround name="popup_panel"/>
</j:ApplicationMainContent>

请帮助

1 个答案:

答案 0 :(得分:0)

想象一下,您没有在mxml中声明按钮面板。您可以使用以下代码创建它:

// This creates the ButtonPlayGround view
var bp:ButtonPlayGround = new ButtonPlayGround();
// then we need to assign the name
bp.name = "button_panel";
// finally you need to add to the ApplicationMainContent container
main.addElement(bp);

现在,当您尝试显示该视图时,就会得到它。