SAPUI5路由和交叉导航

时间:2018-05-24 08:00:20

标签: routing sapui5 router cross-application

我想在我的应用中导航并进行跨应用导航。

在我的manifest.json中,我有一个" routerClass" :" sap.m.routing.Router" 当我定义这个类时,我的内部导航工作正常,但应用程序之间的交叉导航不再工作(网址更改,但导航从未发生过 - 我必须刷新以进入右页)。

如果我改变了这个类,后退按钮总是转到第一页而不是最后一页访问,但交叉导航工作正常。

你能帮帮我吗?

这是我的代码:

的manifest.json

        "routing": {
            "config": {
                "routerClass": "sap.m.routing.Router",
                "viewType": "XML",
                "viewPath": "JoskinEngineItem.view",
                "controlId": "app",
                "controlAggregation": "pages",
                "transition": "slide",
                "fullWidth": true,
                "clearTarget": false,
                "clearAggregation": false
            },
            "routes": [
                {
                    "pattern": "",
                    "name": "index",
                    "target": "index"
                },
                {
                    "pattern": "indexlevel/{key}",
                    "name": "indexlevel",
                    "target": "indexlevel"
                },
                {
                    "pattern": "search/{key}",
                    "name": "search",
                    "target": "search"
                },
                {
                    "pattern": "class/{key}",
                    "name": "class",
                    "target": "class"
                },
                {
                    "pattern": "production/{key}",
                    "name": "production",
                    "target": "production"
                }
            ],
            "targets": {
                "index": {
                    "viewName": "Index",
                    "viewId": "index",
                    "viewLevel": 1
                },
                "indexlevel": {
                    "viewName": "indexlevel",
                    "viewId": "indexlevel",
                    "viewLevel": 2
                },
                "search": {
                    "viewName": "Search",
                    "viewId": "search",
                    "viewLevel": 5,
                    "transition": "flip"
                },
                "class": {
                    "viewName": "Class",
                    "viewId": "class",
                    "viewLevel": 3
                },
                "production": {
                    "viewName": "Production",
                    "viewId": "production",
                    "viewLevel": 4
                }
            }
        },

跨应用导航

    var oCrossAppNavigator = sap.ushell.Container.getService("CrossApplicationNavigation");

    var hash = (oCrossAppNavigator && oCrossAppNavigator.hrefForExternal({
    target: {
    semanticObject: "Link",
    action: "Display"
    }
    })) || "";
    oCrossAppNavigator.toExternal({target: {shellHash: hash}});

0 个答案:

没有答案