1

我想在 stackoverflow 上分享 SAPUI5 的工作现场示例,但我不知道如何创建 JSBin 示例或我们必须添加哪些内容,或者是否有任何简单的方法来创建 JSBin 的演示示例。

4

2 回答 2

1

或者,您可以通过单击蓝色的“运行代码片段”按钮创建可运行的堆栈片段:

sap.ui.controller("view1.initial", {
onInit : function(oEvent) {
    var oModel = new sap.ui.model.json.JSONModel();
    oModel.setData({
        rows : [
            { value : "sap-icon://syringe",    col2 : "Value 2",  col3 : "Value 3",  ol4 : "Value 4" },
            { value : "sap-icon://account",    col2 : "Value 10", col3 : "Value 11", col4 : "Value 12" },
            { value : "sap-icon://chalkboard", col2 : "Value 14", col3 : "Value 15", col4 : "Value 16" },
            { value : "sap-icon://e-care",     col2 : "Value 18", col3 : "Value 19", col4 : "Value 20" }
        ]
    });

    this.getView().setModel(oModel);
}
});

sap.ui.xmlview("main", {
viewContent: jQuery("#view1").html()
})
.placeAt("uiArea");
/* extra CSS classes here */
<script id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_bluecrystal"
data-sap-ui-xx-bindingSyntax="complex"
data-sap-ui-libs="sap.m"></script>

<div id="uiArea"></div>

<script id="view1" type="ui5/xmlview">
<mvc:View controllerName="view1.initial" xmlns="sap.m" xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc">
    <Table items="{/rows}">
        <columns>
            <Column>
                <Text text="Col1" />
            </Column>
            <Column>
                <Text text="Col2" />
            </Column>
            <Column>
                <Text text="Col3" />
            </Column>
        </columns>
        <items>
            <ColumnListItem>
                <cells>
                    <core:Icon src="{value}" />
                    <Text text="{col2}" />
                    <Text text="{col3}" />
                </cells>
            </ColumnListItem>
        </items>
    </Table>
</mvc:View>
</script>

于 2016-06-14T10:52:47.620 回答
0

您将需要引导脚本,View该脚本仅位于HTML选项卡中,并且位于JavascriptController选项卡下。

您可以在登录后将其保存模板,并将其用作示例的起点。

于 2016-06-14T09:58:52.833 回答