@doubao-dev/taro-runtime 0.11.0-rc.10 → 0.11.0

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/README.md CHANGED
@@ -42,5 +42,6 @@ observer.relativeToViewport({ bottom: 100 }).observe('#target', (res) => {
42
42
 
43
43
  - **`useRouter(live?)`**:读取 `{ path, params }`(`path` 以 `/` 开头,`params` 值为字符串);传 `true` 时响应宿主地址更新。
44
44
  - **`getCurrentInstance()`**:返回 `{ app, page, router }`(未初始化时对应项为 `null`)。
45
+ - **`getCurrentPage()`**:返回当前页面(未下发页面地址时为 `null`),支持 `path` / `route` 与 `options` / `query`。
45
46
  - **`getCurrentPages()`**:返回页面栈,支持 `path` / `route` 与 `options` / `query`。
46
47
  - **`getApp()`**:返回已初始化的应用实例,初始化前调用抛错,独立运行环境间不共享。
@@ -8,7 +8,7 @@ export * from './device/index.js';
8
8
  export * from './media/index.js';
9
9
  export { request } from './request/index.js';
10
10
  export { connectSocket, onSocketOpen, onSocketMessage, onSocketError, onSocketClose } from './request/websocket.js';
11
- export { exitMiniProgram, getApp, getCurrentInstance, navigateBack, navigateTo, getCurrentPages, reLaunch, redirectTo, useRouter } from './router/index.js';
11
+ export { exitMiniProgram, getApp, getCurrentInstance, getCurrentPage, getCurrentPages, navigateBack, navigateTo, reLaunch, redirectTo, useRouter } from './router/index.js';
12
12
  export { setStorage, setStorageSync, getStorage, getStorageSync, removeStorage, removeStorageSync, clearStorage, clearStorageSync, getStorageInfo, getStorageInfoSync } from './storage/index.js';
13
13
  export * from './system/index.js';
14
14
  export * from './location/index.js';
package/dist/api/index.js CHANGED
@@ -8,7 +8,7 @@ export * from './device/index.js';
8
8
  export * from './media/index.js';
9
9
  export { request } from './request/index.js';
10
10
  export { connectSocket, onSocketOpen, onSocketMessage, onSocketError, onSocketClose } from './request/websocket.js';
11
- export { exitMiniProgram, getApp, getCurrentInstance, navigateBack, navigateTo, getCurrentPages, reLaunch, redirectTo, useRouter } from './router/index.js';
11
+ export { exitMiniProgram, getApp, getCurrentInstance, getCurrentPage, getCurrentPages, navigateBack, navigateTo, reLaunch, redirectTo, useRouter } from './router/index.js';
12
12
  export { setStorage, setStorageSync, getStorage, getStorageSync, removeStorage, removeStorageSync, clearStorage, clearStorageSync, getStorageInfo, getStorageInfoSync } from './storage/index.js';
13
13
  export * from './system/index.js';
14
14
  export * from './location/index.js';
@@ -10,5 +10,6 @@ export interface TaroCurrentPage {
10
10
  query: Record<string, string>;
11
11
  }
12
12
  export declare function toTaroPage({ route, query }: CurrentPage): TaroCurrentPage;
13
+ export declare function getCurrentPage(): TaroCurrentPage | null;
13
14
  export declare function getCurrentPages(): TaroCurrentPage[];
14
15
  //# sourceMappingURL=get-current-pages.d.ts.map
@@ -1,7 +1,11 @@
1
- import { getCurrentPages as appGetCurrentPages } from '@doubao-dev/framework';
1
+ import { getCurrentPage as appGetCurrentPage, getCurrentPages as appGetCurrentPages } from '@doubao-dev/framework';
2
2
  export function toTaroPage({ route, query }) {
3
3
  return { path: route, route, options: query, query };
4
4
  }
5
+ export function getCurrentPage() {
6
+ const current = appGetCurrentPage();
7
+ return current && toTaroPage(current);
8
+ }
5
9
  export function getCurrentPages() {
6
10
  return appGetCurrentPages().map(toTaroPage);
7
11
  }
@@ -1,7 +1,7 @@
1
1
  export { exitMiniProgram } from './exit-mini-program.js';
2
2
  export { getApp, getCurrentInstance, useRouter } from './current-instance.js';
3
3
  export { navigateBack } from './navigate-back.js';
4
- export { getCurrentPages } from './get-current-pages.js';
4
+ export { getCurrentPage, getCurrentPages } from './get-current-pages.js';
5
5
  export { navigateTo } from './navigate-to.js';
6
6
  export { reLaunch } from './re-launch.js';
7
7
  export { redirectTo } from './redirect-to.js';
@@ -1,7 +1,7 @@
1
1
  export { exitMiniProgram } from './exit-mini-program.js';
2
2
  export { getApp, getCurrentInstance, useRouter } from './current-instance.js';
3
3
  export { navigateBack } from './navigate-back.js';
4
- export { getCurrentPages } from './get-current-pages.js';
4
+ export { getCurrentPage, getCurrentPages } from './get-current-pages.js';
5
5
  export { navigateTo } from './navigate-to.js';
6
6
  export { reLaunch } from './re-launch.js';
7
7
  export { redirectTo } from './redirect-to.js';
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  "./package.json": "./package.json"
38
38
  },
39
39
  "peerDependencies": {
40
- "@doubao-dev/framework": "^0.11.0-rc.10",
40
+ "@doubao-dev/framework": "^0.11.0",
41
41
  "@tarojs/components": "4.1.9",
42
42
  "@tarojs/taro": "4.1.9"
43
43
  },
@@ -61,7 +61,7 @@
61
61
  "access": "public",
62
62
  "registry": "https://registry.npmjs.org/"
63
63
  },
64
- "version": "0.11.0-rc.10",
64
+ "version": "0.11.0",
65
65
  "dependencies": {
66
66
  "@lynx-js/lynx-ui-form": "3.139.0"
67
67
  },