@ray-js/router-mp 1.7.24 → 1.7.26
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/Router.d.ts +2 -1
- package/lib/Router.js +7 -3
- package/lib/RouterScheduler.d.ts +1 -0
- package/lib/RouterScheduler.js +6 -4
- package/package.json +6 -6
package/lib/Router.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { RouteOptions, Router as TRouter } from '@ray-js/types';
|
2
2
|
import { RouterScheduler } from './RouterScheduler';
|
3
3
|
export declare class Router implements TRouter {
|
4
|
+
scheduler: RouterScheduler;
|
4
5
|
private urlPrefix;
|
5
6
|
/**
|
6
7
|
* 功能页模式为 functional,使用相对路径模式
|
@@ -9,12 +10,12 @@ export declare class Router implements TRouter {
|
|
9
10
|
* @private
|
10
11
|
*/
|
11
12
|
private mode;
|
13
|
+
constructor();
|
12
14
|
/**
|
13
15
|
* setUrlPrefix
|
14
16
|
*/
|
15
17
|
setUrlPrefix(prefix: string): void;
|
16
18
|
setMode(mode: string): void;
|
17
|
-
scheduler: RouterScheduler;
|
18
19
|
/**
|
19
20
|
* 标准化路由路径,将 web 标准的地址栏转化到 小程序地址
|
20
21
|
*/
|
package/lib/Router.js
CHANGED
@@ -29,14 +29,19 @@ function pathRelative(fromPath, toPath) {
|
|
29
29
|
}
|
30
30
|
export class Router {
|
31
31
|
// 只有作为其他小程序的子包时,才设置urlPrefix
|
32
|
-
|
32
|
+
|
33
33
|
/**
|
34
34
|
* 功能页模式为 functional,使用相对路径模式
|
35
35
|
* 如果是绝对路径,表示跳转到宿主小程序
|
36
36
|
*
|
37
37
|
* @private
|
38
38
|
*/
|
39
|
-
|
39
|
+
|
40
|
+
constructor() {
|
41
|
+
this.scheduler = new RouterScheduler();
|
42
|
+
this.urlPrefix = '';
|
43
|
+
this.mode = 'miniprogram'; // 默认小程序模式
|
44
|
+
}
|
40
45
|
|
41
46
|
/**
|
42
47
|
* setUrlPrefix
|
@@ -47,7 +52,6 @@ export class Router {
|
|
47
52
|
setMode(mode) {
|
48
53
|
this.mode = mode;
|
49
54
|
}
|
50
|
-
scheduler = (() => new RouterScheduler())();
|
51
55
|
|
52
56
|
/**
|
53
57
|
* 标准化路由路径,将 web 标准的地址栏转化到 小程序地址
|
package/lib/RouterScheduler.d.ts
CHANGED
package/lib/RouterScheduler.js
CHANGED
@@ -28,10 +28,12 @@ export function currentPage() {
|
|
28
28
|
* 小程序路由别名机制,将标准化的 web pathname 转化为小程序的 path
|
29
29
|
*/
|
30
30
|
export class RouterScheduler extends IRouterScheduler {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
31
|
+
constructor() {
|
32
|
+
super();
|
33
|
+
this.$entityMap = [];
|
34
|
+
this.$subPackageRoute = {};
|
35
|
+
this.$pathMap = [];
|
36
|
+
}
|
35
37
|
getCurrentRoute() {
|
36
38
|
const {
|
37
39
|
route,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/router-mp",
|
3
|
-
"version": "1.7.
|
3
|
+
"version": "1.7.26",
|
4
4
|
"description": "Ray Core",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -26,20 +26,20 @@
|
|
26
26
|
"@ray-js/api": "^1.6.32"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@ray-js/env": "1.7.
|
30
|
-
"@ray-js/library": "1.7.
|
31
|
-
"@ray-js/types": "1.7.
|
29
|
+
"@ray-js/env": "1.7.26",
|
30
|
+
"@ray-js/library": "1.7.26",
|
31
|
+
"@ray-js/types": "1.7.26",
|
32
32
|
"@react-navigation/core": "^6.4.17",
|
33
33
|
"path-to-regexp": "^6.3.0",
|
34
34
|
"slash": "^5.1.0"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
|
-
"@ray-js/cli": "1.7.
|
37
|
+
"@ray-js/cli": "1.7.26",
|
38
38
|
"typescript": "^5.8.3"
|
39
39
|
},
|
40
40
|
"publishConfig": {
|
41
41
|
"access": "public",
|
42
42
|
"registry": "https://registry.npmjs.org"
|
43
43
|
},
|
44
|
-
"gitHead": "
|
44
|
+
"gitHead": "0f0e27274b5e9fd7ecfcccac589db39e5a599971"
|
45
45
|
}
|