<!DOCTYPE HTML>
<html style="height: 100%;">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Demo</title>
<script id="sap-ui-bootstrap"
src="https://sdk.openui5.org/nightly/resources/sap-ui-core.js"
data-sap-ui-on-init="module:sap/ui/core/ComponentSupport"
data-sap-ui-async="true"
data-sap-ui-compat-version="edge"
data-sap-ui-resource-roots='{"demo": "./"}'
data-sap-ui-xx-component-preload="off"
data-sap-ui-xx-wait-for-theme="init"
></script>
</head>
<body id="content" class="sapUiBody">
<div data-sap-ui-component
data-id="rootComponentContainer"
data-name="demo"
data-height="100%"
data-settings='{"id": "rootComponent"}'
></div>
</body>
</html>
sap.ui.define([
"sap/ui/core/UIComponent",
"sap/ui/Device",
"sap/ui/core/ComponentSupport",//https://github.com/SAP/ui5-tooling/issues/381
], function(UIComponent, Device) {
"use strict";
return UIComponent.extend("demo.Component", {
metadata: {
interfaces: [
"sap.ui.core.IAsyncContentCreation",
],
manifest: "json",
},
init: function () {
UIComponent.prototype.init.apply(this, arguments);
this.getModel("lazy").setProperty("/enabled", false);
this.getModel("block").setProperty("/mode", "Mode_1");
this.getRouter().initialize();
},
});
});
{
"_version": "1.50.0",
"start_url": "index.html",
"sap.app": {
"id": "demo",
"type": "application",
"title": "Demo",
"description": "Sample Code",
"applicationVersion": {
"version": "1.0.0"
}
},
"sap.ui": {
"technology": "UI5",
"deviceTypes": {
"desktop": true,
"tablet": true,
"phone": true
}
},
"sap.ui5": {
"dependencies": {
"minUI5Version": "1.46.7",
"libs": {
"sap.ui.core": {},
"sap.m": {},
"sap.uxap": {},
"sap.ui.layout": {},
"sap.ui.unified": {}
}
},
"contentDensities": {
"compact": true,
"cozy": true
},
"resources": {
"css": []
},
"models": {
"lazy": {
"type": "sap.ui.model.json.JSONModel"
},
"block": {
"type": "sap.ui.model.json.JSONModel"
}
},
"rootView": {
"viewName": "demo.view.App",
"id": "rootView",
"type": "XML",
"displayBlock": true,
"height": "100%",
"async": true
},
"routing": {
"routes": [{
"name": "home",
"pattern": "",
"target": "home",
"titleTarget": "home"
}],
"targets": {
"home": {
"viewId": "homeView",
"viewName": "Home",
"transition": "fade",
"viewLevel": 1
},
"notFound": {
"viewName": "Home",
"transition": "slide",
"viewLevel": 98
}
},
"config": {
"async": true,
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "demo.view",
"controlId": "rootApp",
"controlAggregation": "pages",
"transition": "slide",
"bypassed": {
"target": "notFound"
},
"homeRoute": "home"
}
}
}
}
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" displayBlock="true">
<App id="rootApp" />
</mvc:View>
<mvc:View xmlns:mvc="sap.ui.core.mvc"
xmlns:block="demo.block"
xmlns:uxap="sap.uxap"
xmlns="sap.m"
height="100%"
>
<uxap:ObjectPageLayout enableLazyLoading="{lazy>/enabled}">
<uxap:headerTitle>
<uxap:ObjectPageHeader objectTitle="Switch Mode">
<uxap:actions>
<SegmentedButton selectedKey="{block>/mode}">
<items>
<SegmentedButtonItem key="Mode_1" text="Mode 1" />
<SegmentedButtonItem key="Mode_2" text="Mode 2" />
</items>
</SegmentedButton>
</uxap:actions>
<uxap:sideContentButton>
<ToggleButton text="enableLazyLoading" pressed="{lazy>/enabled}" />
</uxap:sideContentButton>
</uxap:ObjectPageHeader>
</uxap:headerTitle>
<uxap:headerContent>
<block:MyBlock id="myBlock" mode="{block>/mode}" />
</uxap:headerContent>
</uxap:ObjectPageLayout>
</mvc:View>
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
<Title text="Mode 1" />
</mvc:View>
<mvc:View xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m">
<Title text="Mode 2!!!" />
</mvc:View>
sap.ui.define([
"sap/uxap/BlockBase"
], function(BlockBase) {
"use strict";
return BlockBase.extend("demo.block.MyBlock", {
metadata: {
views: {
"Mode_1": {
viewName: "demo.view.MyBlockMode_1",
type: "XML",
},
"Mode_2": {
viewName: "demo.view.MyBlockMode_2",
type: "XML",
}
}
}
});
});