SAPUI5中的自定义Gif加载程序

时间:2017-08-02 12:07:13

标签: sapui5

如何在自定义UI5应用程序中使用自定义.gif文件预加载器。单击弹出按钮或导航延迟按钮时。

以下是我的代码

<content>
        <Button
            text="Dialog"
            width="230px"
            press="onDialogPress"
            class="sapUiSmallMarginBottom" />
    </content>

onDialogPress: function(oEvent) {

    var that = this;
    if (!that.pressDialog) {
        that.pressDialog = new sap.m.BusyDialog({
            text: 'Loading...',
        });

        //to get access to the global model
        this.getView().addDependent(that.pressDialog);
    }

    that.pressDialog.open();
},

1 个答案:

答案 0 :(得分:1)

BusyDialog可以选择添加自定义图片:

onDialogPress: function(oEvent) {
    if (!this.pressDialog) {
        this.pressDialog = new sap.m.BusyDialog({
            text: 'Loading...',
            customIcon: './stackoverflow/loading.gif',
            customIconRotationSpeed: 0,
            customIconWidth: '48px',
            customIconHeight: '48px'
        });
        this.getView().addDependent(that.pressDialog);
    }
    this.pressDialog.open();
}

结果:
enter image description here