在 应用 yo 创立好的 SAP UI5 我的项目里,应用命令行:

yo easy-ui5 project newview:

输出新的视图名称为 Products,创立新的控制器,以及在 manifest.json 里定义新的 route:

manifest.json routing 区域里三个节点削减了新属性:

target 区域削减了新的 id 和 name 同名的Products 视图,实现类型为 XML:

把 pattern 里字符串内容去掉,变成"":

webapp/view/Mainview.view.xml 是整个利用的外层容器。将 app 标签页里的内容全副删除:

创立进去的 Products 页面的内容为:

<mvc:View controllerName="tutorial.products.controller.Products" displayBlock="true"  xmlns="sap.m"  xmlns:mvc="sap.ui.core.mvc">  <Page id="Products" title="Available Products">    <content>      <List items="{/Products}">        <StandardListItem type="Active" title="{ProductName}" />      </List>    </content>  </Page></mvc:View>

应用 aggregation bindings,定义了一个 list.

应用命令行 yo easy-ui5 project newmodel 创立一个新模型:

所有到 data source 的数据申请,都会被发送到这个 url:

<webapp URL>/V2/Northwind/Northwind.svc/.

Modify the uimodule/webapp/xsapp.json file to redirect the traffic to a destination.

批改 xsapp.json, 将申请从新路由到 destination.

{  "welcomeFile": "/flpSandbox.html",  "routes": [    {      "source": "^/V2/(.*)$",      "authenticationType": "none",      "destination": "Northwind",      "csrfProtection": false    },    {      "source": "^(.*)",      "target": "$1",      "authenticationType": "xsuaa",      "service": "html5-apps-repo-rt"    }  ]}
You already created a destination named Northwind in Cloud Foundry environment of SAP BTP. Now it’s time to add a mocked destination to your local setup as well.

在 uimodule 文件夹上面的 ui5.yaml 文件里:

定义一个本地 destination:

应用 npm ui5 启动工程。

最初的成果:

更多Jerry的原创文章,尽在:"汪子熙":