For AI agents: the complete documentation index is available at /apps-plugin/docs/llms.txt, the full documentation bundle is available at /apps-plugin/docs/llms-full.txt, and this page is available as Markdown at /apps-plugin/docs/js-api/router/openPage.md.

openPage

打开应用内页面。

在主对话流卡片中调用时会重新打开全页并忽略 mode;在全页或全页内 Chat UI 的卡片中调用时按照 mode 操作页面栈。

扫码预览

扫码预览 openPage

支持版本

前端库版本不低于 0.2.0。

支持平台

平台支持情况
Android支持
iOS支持
PC不支持
HarmonyOS不支持

使用说明

  • mode 省略时按 push 处理;主对话流卡片中重新打开全页,全页及其 Chat UI 中应用页面栈操作。

调用方式

异步 API

openPage(params: OpenPageParams): Promise<object>

入参

名称类型必填默认值约束说明
modeOpenPageMode否'push'-页面栈操作。

  • push:始终压入新的页面实例。
  • replace:目标为栈顶页面时更新栈顶页面,否则替换栈顶页面。
  • navigate:目标已在栈中时回退到最近的目标页面并更新,否则压入新页面。
  • pop_to:目标已在栈中时回退到最近的目标页面并更新,否则替换栈顶页面。
urlstring是--应用内页面路径,可携带查询参数。

调用示例

import { openPage } from '@doubao-dev/framework/api';

await openPage({
  url: '/pages/detail/index?id=1',
  mode: 'navigate'
});

成功返回

无返回字段。