0
我想爲sap.m.Page轉換編寫自定義轉換。 如何從此開始? 正是我想知道的任何文檔,如何創建一個自定義轉換並註冊相同,以便它可以在SAP UI5應用程序中使用。sap.m.App的自定義轉換
在此先感謝
我想爲sap.m.Page轉換編寫自定義轉換。 如何從此開始? 正是我想知道的任何文檔,如何創建一個自定義轉換並註冊相同,以便它可以在SAP UI5應用程序中使用。sap.m.App的自定義轉換
在此先感謝
在App導航時自定義轉換的示例實現。點擊列表項以查找轉換。沒有文件。這只是一個黑客。
jQuery.sap.require('sap.m.NavContainer');
\t \t jQuery.sap.require('sap.ui.thirdparty.jqueryui.jquery-ui-core');
\t \t jQuery.sap.require('sap.ui.thirdparty.jqueryui.jquery-ui-effect')
\t \t jQuery.sap.require('sap.ui.thirdparty.jqueryui.jquery-effects-core');
\t \t jQuery.sap.require('sap.ui.thirdparty.jqueryui.jquery-effects-clip');
\t \t
sap.m.NavContainer.transitions["custom"] = {
\t
\t \t \t to: function(oFromPage, oToPage, fCallback) {
\t \t \t \t window.setTimeout(function(){
\t \t \t \t \t oFromPage.$().toggle("clip");
\t \t \t \t \t oToPage.$().toggle("clip");
\t \t \t \t \t fCallback();
\t \t \t \t },600);
\t \t \t \t
\t \t \t },
\t
\t \t \t back: function(oFromPage, oToPage, fCallback) {
\t \t \t \t window.setTimeout(function(){
\t \t \t \t \t debugger;
\t \t \t \t \t oFromPage.$().toggle("clip");
\t \t \t \t \t oToPage.$().toggle("clip");
\t \t \t \t \t fCallback();
\t \t \t \t },600);
\t \t \t }
\t };/* code for transition */
var data = {
\t \t \t \t names: [
\t \t \t \t \t {firstName: "Peter", lastName: "Mueller"},
\t \t \t \t \t {firstName: "Petra", lastName: "Maier"},
\t \t \t \t \t {firstName: "Thomas", lastName: "Smith"},
\t \t \t \t \t {firstName: "John", lastName: "Williams"},
\t \t \t \t \t {firstName: "Maria", lastName: "Jones"}
\t \t \t \t ]
\t \t \t };
\t \t \t
\t \t \t // create a Model with this data
\t \t \t var model = new sap.ui.model.json.JSONModel();
\t \t \t model.setData(data);
\t
\t \t \t var list = new sap.m.List({
\t \t \t \t headerText:"Names"
\t \t \t });
\t \t \t
\t \t \t list.bindItems({
\t \t \t \t path : "/names",
\t \t \t \t sorter : new sap.ui.model.Sorter("lastName"),
\t \t \t \t template : new sap.m.StandardListItem({
\t \t \t \t \t title: "{lastName}",
\t \t \t \t \t description: "{firstName}",
\t \t \t \t \t type: sap.m.ListType.Navigation,
\t \t \t \t \t press:function(evt){
\t \t \t \t \t \t var oBindingContext = evt.getSource().getBindingContext();
\t \t \t \t \t \t page2.setBindingContext(oBindingContext);
\t \t \t \t \t \t app.to("page2","custom");
\t \t \t \t \t }
\t \t \t \t })
\t \t \t });
\t \t \t
\t \t \t // create the page holding the List
\t \t \t var page1 = new sap.m.Page("page1",{
\t \t \t \t title: "List Page",
\t \t \t \t content : list
\t \t \t });
\t \t \t
\t \t \t // create the detail page
\t \t \t var page2 = new sap.m.Page("page2", {
\t \t \t \t title: "Detail Page",
\t \t \t \t showNavButton: true,
\t \t \t \t navButtonPress: function(){
\t \t \t \t \t app.back();
\t \t \t \t },
\t \t \t \t content : [
\t \t \t \t \t new sap.ui.layout.form.SimpleForm({
\t \t \t \t \t \t title: "Details for {firstName} {lastName}",
\t \t \t \t \t \t content: [
\t \t \t \t \t \t \t new sap.m.Label({text: "First Name"}),
\t \t \t \t \t \t \t new sap.m.Text({text: "{firstName}"}),
\t \t \t \t \t \t \t new sap.m.Label({text: "Last Name"}),
\t \t \t \t \t \t \t new sap.m.Text({text: "{lastName}"})
\t \t \t \t \t \t ]
\t \t \t \t \t })
\t \t \t \t ]
\t \t \t });
\t \t \t
\t \t \t // create a mobile App holding the pages and place the App into the HTML document
\t \t \t var app = new sap.m.App({
\t \t \t \t pages: [page1, page2]
\t \t \t }).placeAt("content");
\t \t \t
\t \t \t // set the model to the App; it will be propagated to the children
\t \t \t app.setModel(model);
<html>
\t <head>
\t \t <meta http-equiv="X-UA-Compatible" content="IE=edge" />
\t \t <meta http-equiv='Content-Type' content='text/html;charset=UTF-8'/>
\t \t <link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
\t \t <title>Custom jQuery transition</title>
\t \t
\t \t <script src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
\t \t \t \t id="sap-ui-bootstrap"
\t \t \t \t data-sap-ui-libs="sap.m,sap.ui.layout"
\t \t \t \t data-sap-ui-xx-bindingSyntax="complex"
\t \t \t \t data-sap-ui-theme="sap_bluecrystal"></script>
\t \t
\t </head>
\t <body id="content" class="sapUiBody">
\t </body>
</html>
的文檔可以在[addCustomTransition]中找到(https://sapui5.hana.ondemand.com/docs/api/symbols/sap.m.NavContainer.html#addCustomTransition) 。要了解我們如何實現自己的功能,請查看[其他轉換在此]的源代碼(https://github.com/SAP/openui5/blob/rel-1.48.5/src/sap.m/src /sap/m/NavContainer.js#L1042)。 – boghyon 2017-08-22 16:04:47