如何使用SAP UI5 xml视图

man*_*ani 0 sapui5

我是SAP UI5的新手.

我的任务是将javascript代码转换为xml视图.这里javascript就像:

 var sHtmlText = '<strong>Aliquam erat volutpat.</strong><br>Vivamus vitae felis nec lacus ultricies dapibus condimentum quis felis.';
    sHtmlText += 'Some link goes here:<embed data-index=\"0\">';

    var oLink2 = new sap.ui.commons.Link("l2", {
        text : "Click me",
        href : "http://scn.sap.com/welcome",
        title : "SAP Community Network",
        target : "_blank"
    });

    var oFTV2 = new sap.ui.commons.FormattedTextView("otv2");
    //set the text with placeholders inside
    oFTV2.setHtmlText(sHtmlText);
    //add the desired control to the FormattedTextView
    oFTV2.addControl(oLink2);

    var oCallout = new sap.ui.commons.Callout({
        content : oFTV2
    });

    // create a sample form with two fields and assign a callout to each of them
    var oLayout = new sap.ui.commons.layout.MatrixLayout({
        layoutFixed : false
    });
    var oTextField, oLabel;
    oLayout.createRow(
        oLabel = new sap.ui.commons.Label({text:"First name:", labelFor:"firstname1"}),
        oTextField = new sap.ui.commons.TextField("firstname1", {required:true, value:"John"})
    );
    oTextField.setTooltip(oCallout);
    // display it
    oLayout.placeAt("sample2");
Run Code Online (Sandbox Code Playgroud)

在运行上面的代码时,我得到带有标签的文本字段并输入悬停弹出窗口.

现在我的任务是将上面的js视图转换为XML视图.我很困惑.

请建议我将上述JS视图转换为XML视图的确切过程(通用方式).

Qua*_*ure 5

快速(和脏)的方法是简单地运行您的应用程序,当您在视图中转换为XML时,打开SAPUI5诊断屏幕(Ctrl-Alt-Shift S),显示"控制树"面板,选择最顶层的UIArea元素,单击"导出" '右侧的选项卡,然后单击'导出到XML'按钮:)