无法在 sap.m.page 中创建图标

can not create icon in sap.m.page

为什么我无法在我的页面中创建图标?它只有一个应用程序和一个页面,但仍然无法正常工作。

createContent : function(oController) {
        var app = new sap.m.App();
        var statusPage = sap.m.Page("statusPage",{
            title : "some app",
        });
        statusPage.setIcon("http://www.sap.com/global/ui/images/global/sap-logo.png");
        app.addPage(statusPage);
        return app;

    }

sap.m.Page 上的图标只设置了 NavButton,已被弃用。您使用的是什么版本?来自当前文档:

Deprecated:
Since version 1.20. Deprecated since the MVI theme is removed now. This property only affected the NavButton in that theme.

如果要向页面标题添加图标,则需要使用页面控件的 customHeader 聚合。为其分配一个工具栏,在工具栏中,您可以添加图标按钮和标题。请注意,title 属性 在使用 customHeader 时将不再起作用。

因此您的控件层次结构将类似于:(控件以大写字母开头,聚合以 lower-case 字母开头)

Page
    customHeader
        Toolbar
            content
                Button (with icon
                ToolbarSpacer
                Text
                ToolbarSpacer