@ray-js/framework-shared 0.6.22-beta-1 → 0.6.22-beta-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/normalizeTabBar.js +26 -2
- package/package.json +5 -5
package/lib/normalizeTabBar.js
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
|
3
|
+
import "core-js/modules/es.array.map.js";
|
2
4
|
import "core-js/modules/es.array.filter.js";
|
3
5
|
import "core-js/modules/es.object.to-string.js";
|
4
|
-
import "core-js/modules/es.array.map.js";
|
5
6
|
import "core-js/modules/es.array.find.js";
|
6
7
|
import "core-js/modules/es.array.concat.js";
|
7
8
|
import "core-js/modules/es.json.stringify.js";
|
@@ -10,11 +11,34 @@ export function normalizeTabBar(tabBar, routes) {
|
|
10
11
|
var list = tabBar.list;
|
11
12
|
|
12
13
|
if (Array.isArray(list)) {
|
13
|
-
|
14
|
+
list = list.map(function (tab) {
|
15
|
+
var _iterator = _createForOfIteratorHelper(routes),
|
16
|
+
_step;
|
17
|
+
|
18
|
+
try {
|
19
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
20
|
+
var r = _step.value;
|
21
|
+
|
22
|
+
// 兼容老项目
|
23
|
+
if (tab.id === r.id) {
|
24
|
+
return _objectSpread(_objectSpread({}, tab), {}, {
|
25
|
+
pagePath: r.path
|
26
|
+
});
|
27
|
+
}
|
28
|
+
}
|
29
|
+
} catch (err) {
|
30
|
+
_iterator.e(err);
|
31
|
+
} finally {
|
32
|
+
_iterator.f();
|
33
|
+
}
|
34
|
+
|
35
|
+
return tab;
|
36
|
+
}); // tabBar.list[number].pagePath 必须在 routes[number].page 中,即tab.pagePath === routes[number].page
|
14
37
|
// tabBar.list[number].route 可不配置
|
15
38
|
// tabBar.list[number].route 若未配置,则设置 tabBar.list[number].route = routes[number].page(非模式匹配)或tabBar.list[number].pagePath
|
16
39
|
// tabBar.list[number].route 不能用模式,如不能用/xxx/:id等,必须是明确的 如/xxx/123
|
17
40
|
// tabBar.list[number].route 必须要能命中对应routes[number].route 路由规则,规则详见 path-to-regexp 模块
|
41
|
+
|
18
42
|
tabBar.list = list.map(function (tab, index) {
|
19
43
|
var _m$route;
|
20
44
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/framework-shared",
|
3
|
-
"version": "0.6.22-beta-
|
3
|
+
"version": "0.6.22-beta-2",
|
4
4
|
"description": "Ray shared for framework",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -21,12 +21,12 @@
|
|
21
21
|
},
|
22
22
|
"dependencies": {
|
23
23
|
"@ray-core/wechat": "^0.0.x",
|
24
|
-
"@ray-js/env": "^0.6.22-beta-
|
25
|
-
"@ray-js/types": "^0.6.22-beta-
|
24
|
+
"@ray-js/env": "^0.6.22-beta-2",
|
25
|
+
"@ray-js/types": "^0.6.22-beta-2",
|
26
26
|
"path-to-regexp": "^6.2.1"
|
27
27
|
},
|
28
28
|
"devDependencies": {
|
29
|
-
"@ray-js/cli": "^0.6.22-beta-
|
29
|
+
"@ray-js/cli": "^0.6.22-beta-2"
|
30
30
|
},
|
31
31
|
"maintainers": [
|
32
32
|
{
|
@@ -34,6 +34,6 @@
|
|
34
34
|
"email": "tuyafe@tuya.com"
|
35
35
|
}
|
36
36
|
],
|
37
|
-
"gitHead": "
|
37
|
+
"gitHead": "5d621bf1561047175b967cdf3aa35446f7d7198a",
|
38
38
|
"repository": {}
|
39
39
|
}
|