标签:yo destination 视图 json UI5 ui5 Northwind
在 使用 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:
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的原创文章,尽在:"汪子熙":
标签:yo,destination,视图,json,UI5,ui5,Northwind 来源: https://www.cnblogs.com/sap-jerry/p/14727280.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。