From 0260f284244c07ba62cbcaac24a8bdbefd126a53 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Mon, 4 Nov 2024 11:49:59 +0800 Subject: [PATCH] =?UTF-8?q?docs(UniPage):=20=E4=BC=98=E5=8C=96=20this.$pag?= =?UTF-8?q?e=20=E8=8E=B7=E5=8F=96=E9=A1=B5=E9=9D=A2=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/api/dialog-page.md | 4 ++++ docs/api/get-current-pages.md | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/docs/api/dialog-page.md b/docs/api/dialog-page.md index c3421fdc..4f60b078 100644 --- a/docs/api/dialog-page.md +++ b/docs/api/dialog-page.md @@ -87,6 +87,10 @@ const page = pages[pages.length-1] const dialogPages = page.getDialogPages() // 2. 在 dialogPage 中通过 this.$page 获取 dialogPage 实例 +// 选项式 API const dialogPage = this.$page +// 组合式 API +const currentInstance = getCurrentInstance() +const dialogPage = instance?.proxy?.$page ``` * `UniDialogPage` 实例的 `getElementById` 方法仅 `Android` 端支持,其他端返回 `null`。 diff --git a/docs/api/get-current-pages.md b/docs/api/get-current-pages.md index 6897dd8c..cd142d60 100644 --- a/docs/api/get-current-pages.md +++ b/docs/api/get-current-pages.md @@ -51,3 +51,13 @@ UniPage对象强化了开发者对页面的管理功能,并且支持在uts插 + +## Tips +* `4.32` 新增支持通过 `this.$page` 获取当前 `UniPage` 实例, 代码示例: +```js +// 选项式 API +const dialogPage = this.$page +// 组合式 API +const currentInstance = getCurrentInstance() +const dialogPage = instance?.proxy?.$page +``` -- GitLab