官网链接:https://sapui5.hana.ondemand….
一个例子:
"routing": {
"config": {
"routerClass": "sap.m.routing.Router",
"viewType": "XML",
"viewPath": "kyma.sample.app.view",
"controlId": "app",
"controlAggregation": "pages",
"async": true
},
"routes": [
{"pattern": "","name":"orders","target": ["orders"]
}
],
"targets": {
"orders": {
"viewName": "Orders",
"viewId": "orders",
"viewLevel": 1,
"title": "{i18n>title}"
}
}
在 manifest.json 文件的 sap.ui5 区域,增加了三个子区域:
(1) config
(2) routes
(3) target
config
This section contains the global router configuration and default values that apply for all routes and targets.
蕴含了全局路由器信息和适应于所有路由门路和指标的默认值。
We define the router class that we want to use and where our views are located in the app.
定义了路由器实现类以及咱们的视图在利用中的具体位置。
To load and display views automatically, we also specify which control is used to display the pages and what aggregation should be filled when a new page is displayed.
为了让视图可能显示进去,须要定义哪个控件用于显示页面,以及页面通过何种 aggregation,填充到该控件去。
routes
Each route defines a name, a pattern, and one or more targets to navigate to when the route has been hit.
每条路由信息定义了一个名称,一个格局,以及一个路由目标视图,当该路由触发时,目标视图会显示。
The pattern is basically the URL part that matches to the route, we define two routes for our app.
所谓 pattern,即待匹配的 URL 片段。
例子:
更多 Jerry 的原创文章,尽在:” 汪子熙 ”: