@doubao-dev/plugin-app-dev 0.0.0-stage → 0.0.40-canary-dea0ddc73-20261026073950
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 +10 -2
- package/dist/147.js +9 -0
- package/dist/assets.d.ts +5 -0
- package/dist/assets.js +4 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +1378 -0
- package/dist/plugin.d.ts +102 -0
- package/dist/plugin.js +4995 -0
- package/dist/preview.js +16 -0
- package/dist/rslib-runtime.js +33 -0
- package/dist/skills/doubao-plugin-app/SKILL.md +21 -0
- package/dist/skills/doubao-plugin-app/references/app-development.md +85 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/container-overlay.md +131 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/form-controls.md +146 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/interactive-controls.md +120 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/map-canvas.md +107 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/overview.md +43 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/scroll-list.md +149 -0
- package/dist/skills/doubao-plugin-app/references/frontend/components/text-media.md +209 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/01-/345/237/272/347/241/200.md +1389 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/02-/347/263/273/347/273/237.md +1376 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/03-/350/207/252/345/256/232/344/271/211/351/200/232/344/277/241.md +127 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/04-/345/256/232/344/275/215.md +784 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/05-/345/255/230/345/202/250.md +1176 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/06-/350/267/257/347/224/261.md +839 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/07-/347/225/214/351/235/242.md +376 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/08-/344/272/244/344/272/222.md +1319 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/09-/350/276/223/345/205/245.md +192 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/10-/347/275/221/347/273/234.md +900 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/11-/345/252/222/344/275/223.md +1496 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/12-/344/270/232/345/212/241/350/203/275/345/212/233.md +1281 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/13-/347/231/273/345/275/225.md +511 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/14-/346/224/257/344/273/230.md +943 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/15-/346/225/260/346/215/256/345/210/206/346/236/220.md +124 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/16-/350/223/235/347/211/231.md +3364 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/17-wi-fi.md +1028 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/18-/345/212/240/351/200/237/345/272/246/350/256/241.md +354 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/19-ibeacon.md +508 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/20-/347/275/227/347/233/230.md +320 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/21-/350/256/276/345/244/207/346/226/271/345/220/221.md +351 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/22-/351/231/200/350/236/272/344/273/252.md +354 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/23-/345/252/222/344/275/223-/350/256/276/345/244/207-/347/275/221/347/273/234.md +264 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/24-/347/237/255/344/277/241.md +155 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/25-/346/227/240/351/232/234/347/242/215.md +144 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/26-/345/237/272/347/241/200/344/277/241/346/201/257.md +238 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/27-/347/224/265/346/261/240.md +235 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/28-/345/211/252/350/264/264/346/235/277.md +303 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/29-/345/212/240/345/257/206.md +126 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/30-/346/227/245/345/216/206.md +417 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/31-/347/224/265/350/257/235.md +144 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/32-/346/211/253/347/240/201.md +236 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/33-/345/261/217/345/271/225.md +747 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/34-/351/234/207/345/212/250.md +277 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/35-/346/226/207/344/273/266/347/263/273/347/273/237.md +431 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/common-errors.md +69 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/groups.md +43 -0
- package/dist/skills/doubao-plugin-app/references/frontend/doubao-agentic-service-api/quick-reference.md +436 -0
- package/dist/skills/doubao-plugin-app/references/frontend/examples/common-patterns.md +590 -0
- package/dist/skills/doubao-plugin-app/references/frontend/examples/doubao-agentic-service-api-recipes.md +209 -0
- package/dist/skills/doubao-plugin-app/references/frontend/examples/page-widget-basics.md +368 -0
- package/dist/skills/doubao-plugin-app/references/frontend/examples/page-widget-recipes.md +65 -0
- package/dist/skills/doubao-plugin-app/references/frontend/framework/core.md +283 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/auth.md +277 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/best-practices.md +574 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/client-tools-and-events.md +209 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/component-development.md +832 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/debugger-mcp.md +537 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/expired-widget.md +101 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/performance-optimization.md +417 -0
- package/dist/skills/doubao-plugin-app/references/frontend/guides/troubleshooting.md +278 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/best-practices.md +720 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/pseudo-classes.md +149 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/selectors.md +224 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/supported-properties.md +269 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/css/values-and-units.md +314 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/flex-layout.md +334 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/grid-layout.md +408 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/linear-layout.md +355 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/layout/relative-layout.md +189 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/css-differences.md +737 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/migration-guide.md +669 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/lynx-vs-web/unsupported-features.md +290 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/overview.md +60 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/animation.md +243 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/responsive.md +194 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/patterns/theming.md +143 -0
- package/dist/skills/doubao-plugin-app/references/frontend/lynx/quick-reference.md +229 -0
- package/dist/skills/doubao-plugin-app/references/frontend/rules/dos-and-donts.md +479 -0
- package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/design-boundary.md +46 -0
- package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/overview.md +118 -0
- package/dist/skills/doubao-plugin-app/references/frontend/widget-templates/props.md +301 -0
- package/dist/skills/doubao-plugin-app/references/mcp-and-cards.md +38 -0
- package/dist/templates/README.md.template +11 -0
- package/dist/templates/com.doubao/app/manifest.yaml +41 -0
- package/dist/templates/com.doubao/app/package.json.template +13 -0
- package/dist/templates/com.doubao/app/src/app.config.ts.template +5 -0
- package/dist/templates/com.doubao/app/src/app.ts.template +3 -0
- package/dist/templates/com.doubao/app/src/pages/home/index.css +14 -0
- package/dist/templates/com.doubao/app/src/pages/home/index.tsx.template +14 -0
- package/dist/templates/com.doubao/app/src/widgets/example/index.tsx.template +29 -0
- package/dist/templates/com.doubao/app/tsconfig.json +19 -0
- package/dist/templates/mcp.json +9 -0
- package/dist/templates/plugin.json.template +29 -0
- package/dist/templates/skills/example/SKILL.md.template +14 -0
- package/dist/upload.d.ts +44 -0
- package/dist/upload.js +38 -0
- package/package.json +60 -3
|
@@ -0,0 +1,1319 @@
|
|
|
1
|
+
# 豆包应用插件的端能力 API: 交互
|
|
2
|
+
|
|
3
|
+
Toast、Loading、Modal、ActionSheet、BottomSheet 和返回前提醒。
|
|
4
|
+
|
|
5
|
+
[返回目录](./groups.md) | [返回速查](./quick-reference.md)
|
|
6
|
+
|
|
7
|
+
## 速查
|
|
8
|
+
|
|
9
|
+
| API | 说明 |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| [enableAlertBeforeUnload](#enablealertbeforeunload) | 开启页面返回前提醒。 当用户在应用插件的非最底层页面点击左上角返回按钮、左上角首页按钮或客户端返回键时,弹起询问弹窗 返回询问对话框只会对调用的当前页面生效,通过手势滑动返回时不会弹起询问对话框。 |
|
|
12
|
+
| [disableAlertBeforeUnload](#disablealertbeforeunload) | 关闭页面返回前提醒。 |
|
|
13
|
+
| [showModal](#showmodal) | 显示模态对话框。 |
|
|
14
|
+
| [showLoading](#showloading) | 显示 loading 提示框。 |
|
|
15
|
+
| [hideToast](#hidetoast) | 隐藏当前 Toast。 |
|
|
16
|
+
| [hideLoading](#hideloading) | 隐藏当前 loading。 |
|
|
17
|
+
| [showActionSheet](#showactionsheet) | 显示操作菜单。 |
|
|
18
|
+
| [showBottomSheet](#showbottomsheet) | 显示豆包底部弹窗。 |
|
|
19
|
+
| [getMenuButtonBoundingClientRect](#getmenubuttonboundingclientrect) | 取菜单按钮(右上角胶囊按钮)的布局位置信息。 |
|
|
20
|
+
| [showToast](#showtoast) | 显示 Toast 提示。 |
|
|
21
|
+
|
|
22
|
+
## API 详情
|
|
23
|
+
|
|
24
|
+
<a id="enablealertbeforeunload"></a>
|
|
25
|
+
### enableAlertBeforeUnload()
|
|
26
|
+
|
|
27
|
+
# enableAlertBeforeUnload
|
|
28
|
+
|
|
29
|
+
开启页面返回前提醒。
|
|
30
|
+
当用户在应用插件的非最底层页面点击左上角返回按钮、左上角首页按钮或客户端返回键时,弹起询问弹窗
|
|
31
|
+
|
|
32
|
+
返回询问对话框只会对调用的当前页面生效,通过手势滑动返回时不会弹起询问对话框
|
|
33
|
+
|
|
34
|
+
## 扫码预览
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
## 支持版本
|
|
38
|
+
|
|
39
|
+
前端库版本不低于 `0.2.0`。
|
|
40
|
+
|
|
41
|
+
## 支持平台
|
|
42
|
+
|
|
43
|
+
<table>
|
|
44
|
+
<thead>
|
|
45
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
46
|
+
</thead>
|
|
47
|
+
<tbody>
|
|
48
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
49
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
50
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
51
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
52
|
+
</tbody>
|
|
53
|
+
</table>
|
|
54
|
+
|
|
55
|
+
## 接入准备
|
|
56
|
+
|
|
57
|
+
### 前置条件
|
|
58
|
+
|
|
59
|
+
- 必须在页面容器内调用
|
|
60
|
+
|
|
61
|
+
## 使用说明
|
|
62
|
+
|
|
63
|
+
配合 disableAlertBeforeUnload 使用。
|
|
64
|
+
|
|
65
|
+
- 仅非根页面的显式返回会展示提醒;根页面退出不拦截,iOS 侧滑返回不拦截。
|
|
66
|
+
|
|
67
|
+
## 调用方式
|
|
68
|
+
|
|
69
|
+
### 异步 API
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
enableAlertBeforeUnload(params: EnableAlertBeforeUnloadParams): Promise<object>
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## 入参
|
|
76
|
+
|
|
77
|
+
<table>
|
|
78
|
+
<thead>
|
|
79
|
+
<tr><th>名称</th><th>类型</th><th>必填</th><th>默认值</th><th>约束</th><th>说明</th></tr>
|
|
80
|
+
</thead>
|
|
81
|
+
<tbody>
|
|
82
|
+
<tr><td><code>message</code></td><td><code>string</code></td><td>是</td><td>-</td><td>-</td><td>返回前确认弹窗的文案。</td></tr>
|
|
83
|
+
</tbody>
|
|
84
|
+
</table>
|
|
85
|
+
|
|
86
|
+
## 调用示例
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { enableAlertBeforeUnload } from '@doubao-dev/framework/api';
|
|
90
|
+
|
|
91
|
+
await enableAlertBeforeUnload({ message: '确定离开当前页面吗?' });
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## 成功返回
|
|
95
|
+
|
|
96
|
+
无返回字段。
|
|
97
|
+
|
|
98
|
+
## 错误处理
|
|
99
|
+
|
|
100
|
+
错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
|
|
101
|
+
|
|
102
|
+
### 失败示例
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
{
|
|
106
|
+
"errNo": 103,
|
|
107
|
+
"errMsg": "feature not support"
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 错误码
|
|
112
|
+
|
|
113
|
+
<table>
|
|
114
|
+
<thead>
|
|
115
|
+
<tr><th>errNo</th><th>errMsg</th><th>平台</th><th>触发条件</th><th>处理建议</th></tr>
|
|
116
|
+
</thead>
|
|
117
|
+
<tbody>
|
|
118
|
+
<tr><td><code>103</code></td><td><code>feature not support</code></td><td>Android、iOS</td><td>当前调用不来自页面容器</td><td>请在页面生命周期内调用。</td></tr>
|
|
119
|
+
<tr><td><code>104</code></td><td><code>invalid parameter</code></td><td>Android、iOS</td><td>message 缺失或类型不是字符串</td><td>传入字符串类型的 message。</td></tr>
|
|
120
|
+
</tbody>
|
|
121
|
+
</table>
|
|
122
|
+
|
|
123
|
+
#### 通用错误码
|
|
124
|
+
|
|
125
|
+
<table>
|
|
126
|
+
<thead>
|
|
127
|
+
<tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
|
|
128
|
+
</thead>
|
|
129
|
+
<tbody>
|
|
130
|
+
<tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android、iOS</td></tr>
|
|
131
|
+
</tbody>
|
|
132
|
+
</table>
|
|
133
|
+
|
|
134
|
+
<a id="disablealertbeforeunload"></a>
|
|
135
|
+
### disableAlertBeforeUnload()
|
|
136
|
+
|
|
137
|
+
# disableAlertBeforeUnload
|
|
138
|
+
|
|
139
|
+
关闭页面返回前提醒。
|
|
140
|
+
|
|
141
|
+
## 扫码预览
|
|
142
|
+

|
|
143
|
+
|
|
144
|
+
## 支持版本
|
|
145
|
+
|
|
146
|
+
前端库版本不低于 `0.2.0`。
|
|
147
|
+
|
|
148
|
+
## 支持平台
|
|
149
|
+
|
|
150
|
+
<table>
|
|
151
|
+
<thead>
|
|
152
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
153
|
+
</thead>
|
|
154
|
+
<tbody>
|
|
155
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
156
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
157
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
158
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
159
|
+
</tbody>
|
|
160
|
+
</table>
|
|
161
|
+
|
|
162
|
+
## 接入准备
|
|
163
|
+
|
|
164
|
+
### 前置条件
|
|
165
|
+
|
|
166
|
+
- 必须在页面容器内调用
|
|
167
|
+
|
|
168
|
+
## 调用方式
|
|
169
|
+
|
|
170
|
+
### 异步 API
|
|
171
|
+
|
|
172
|
+
```typescript
|
|
173
|
+
disableAlertBeforeUnload(params?: object): Promise<object>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 入参
|
|
177
|
+
|
|
178
|
+
无。
|
|
179
|
+
|
|
180
|
+
## 调用示例
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
import { disableAlertBeforeUnload } from '@doubao-dev/framework/api';
|
|
184
|
+
|
|
185
|
+
await disableAlertBeforeUnload();
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## 成功返回
|
|
189
|
+
|
|
190
|
+
无返回字段。
|
|
191
|
+
|
|
192
|
+
## 错误处理
|
|
193
|
+
|
|
194
|
+
错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
|
|
195
|
+
|
|
196
|
+
### 失败示例
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"errNo": 103,
|
|
201
|
+
"errMsg": "feature not support"
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### 错误码
|
|
206
|
+
|
|
207
|
+
<table>
|
|
208
|
+
<thead>
|
|
209
|
+
<tr><th>errNo</th><th>errMsg</th><th>平台</th><th>触发条件</th><th>处理建议</th></tr>
|
|
210
|
+
</thead>
|
|
211
|
+
<tbody>
|
|
212
|
+
<tr><td><code>103</code></td><td><code>feature not support</code></td><td>Android、iOS</td><td>当前调用不来自页面容器</td><td>请在页面生命周期内调用。</td></tr>
|
|
213
|
+
</tbody>
|
|
214
|
+
</table>
|
|
215
|
+
|
|
216
|
+
#### 通用错误码
|
|
217
|
+
|
|
218
|
+
<table>
|
|
219
|
+
<thead>
|
|
220
|
+
<tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
|
|
221
|
+
</thead>
|
|
222
|
+
<tbody>
|
|
223
|
+
<tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android、iOS</td></tr>
|
|
224
|
+
</tbody>
|
|
225
|
+
</table>
|
|
226
|
+
|
|
227
|
+
<a id="showmodal"></a>
|
|
228
|
+
### showModal()
|
|
229
|
+
|
|
230
|
+
# showModal
|
|
231
|
+
|
|
232
|
+
显示模态对话框。
|
|
233
|
+
|
|
234
|
+
## 扫码预览
|
|
235
|
+

|
|
236
|
+
|
|
237
|
+
## 支持版本
|
|
238
|
+
|
|
239
|
+
前端库版本不低于 `0.0.26`。
|
|
240
|
+
|
|
241
|
+
## 支持平台
|
|
242
|
+
|
|
243
|
+
<table>
|
|
244
|
+
<thead>
|
|
245
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
246
|
+
</thead>
|
|
247
|
+
<tbody>
|
|
248
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
249
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
250
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
251
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
252
|
+
</tbody>
|
|
253
|
+
</table>
|
|
254
|
+
|
|
255
|
+
## 支持场景
|
|
256
|
+
|
|
257
|
+
<table>
|
|
258
|
+
<thead>
|
|
259
|
+
<tr><th>场景</th><th>支持情况</th></tr>
|
|
260
|
+
</thead>
|
|
261
|
+
<tbody>
|
|
262
|
+
<tr><td>页面</td><td>支持</td></tr>
|
|
263
|
+
<tr><td>卡片</td><td>支持</td></tr>
|
|
264
|
+
</tbody>
|
|
265
|
+
</table>
|
|
266
|
+
|
|
267
|
+
## 使用说明
|
|
268
|
+
|
|
269
|
+
- 仅当 showCancel 为 true 时展示取消按钮;仅当 tapMaskToDismiss 为 true 时点击蒙层可关闭;editable 为 true 且用户确认时返回输入 content。
|
|
270
|
+
|
|
271
|
+
## 调用方式
|
|
272
|
+
|
|
273
|
+
### 异步 API
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
showModal(params?: ShowModalParams): Promise<ShowModalResult>
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## 入参
|
|
280
|
+
|
|
281
|
+
<table>
|
|
282
|
+
<thead>
|
|
283
|
+
<tr><th>名称</th><th>类型</th><th>必填</th><th>默认值</th><th>约束</th><th>说明</th></tr>
|
|
284
|
+
</thead>
|
|
285
|
+
<tbody>
|
|
286
|
+
<tr><td><code>cancelColor</code></td><td><code>string</code></td><td>否</td><td><code>#000000</code></td><td>必须是 16 进制格式的颜色字符串。</td><td>取消按钮的文字颜色。</td></tr>
|
|
287
|
+
<tr><td><code>cancelText</code></td><td><code>string</code></td><td>否</td><td><code>取消</code></td><td>最多 4 个字符。</td><td>取消按钮的文字。</td></tr>
|
|
288
|
+
<tr><td><code>confirmColor</code></td><td><code>string</code></td><td>否</td><td><code>#F85959</code></td><td>必须是 16 进制格式的颜色字符串。</td><td>确认按钮的文字颜色。</td></tr>
|
|
289
|
+
<tr><td><code>confirmText</code></td><td><code>string</code></td><td>否</td><td><code>确定</code></td><td>最多 4 个字符。</td><td>确认按钮的文字。</td></tr>
|
|
290
|
+
<tr><td><code>content</code></td><td><code>string</code></td><td>否</td><td><code>-</code></td><td>-</td><td>模态对话框的内容。</td></tr>
|
|
291
|
+
<tr><td><code>editable</code></td><td><code>boolean</code></td><td>否</td><td><code>false</code></td><td>-</td><td>是否显示输入框。</td></tr>
|
|
292
|
+
<tr><td><code>placeholderText</code></td><td><code>string</code></td><td>否</td><td><code>-</code></td><td>-</td><td>显示输入框时的提示文本。</td></tr>
|
|
293
|
+
<tr><td><code>showCancel</code></td><td><code>boolean</code></td><td>否</td><td><code>true</code></td><td>-</td><td>是否显示取消按钮。</td></tr>
|
|
294
|
+
<tr><td><code>tapMaskToDismiss</code></td><td><code>boolean</code></td><td>否</td><td><code>true</code></td><td>-</td><td>是否允许点击蒙层关闭对话框。</td></tr>
|
|
295
|
+
<tr><td><code>title</code></td><td><code>string</code></td><td>否</td><td><code>-</code></td><td>-</td><td>模态对话框的标题。</td></tr>
|
|
296
|
+
</tbody>
|
|
297
|
+
</table>
|
|
298
|
+
|
|
299
|
+
## 调用示例
|
|
300
|
+
|
|
301
|
+
```ts
|
|
302
|
+
import { showModal } from '@doubao-dev/framework/api';
|
|
303
|
+
|
|
304
|
+
const result = await showModal({
|
|
305
|
+
title: '提示',
|
|
306
|
+
content: '确认删除这条记录吗?',
|
|
307
|
+
confirmText: '删除',
|
|
308
|
+
cancelText: '取消'
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
if (result.action === 'confirm') {
|
|
312
|
+
console.log('用户确认删除');
|
|
313
|
+
}
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
## 成功返回
|
|
317
|
+
|
|
318
|
+
<table>
|
|
319
|
+
<thead>
|
|
320
|
+
<tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
|
|
321
|
+
</thead>
|
|
322
|
+
<tbody>
|
|
323
|
+
<tr><td><code>action</code></td><td><code>"confirm" | "cancel" | "mask"</code></td><td>是</td><td>用户点击的动作。</td></tr>
|
|
324
|
+
<tr><td><code>content</code></td><td><code>string</code></td><td>否</td><td>`editable` 为 true 时,用户点击确认后输入的文本。</td></tr>
|
|
325
|
+
</tbody>
|
|
326
|
+
</table>
|
|
327
|
+
|
|
328
|
+
### 返回示例
|
|
329
|
+
|
|
330
|
+
```json
|
|
331
|
+
{
|
|
332
|
+
"action": "confirm"
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## 错误处理
|
|
337
|
+
|
|
338
|
+
错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
|
|
339
|
+
|
|
340
|
+
### 错误码
|
|
341
|
+
|
|
342
|
+
#### 通用错误码
|
|
343
|
+
|
|
344
|
+
<table>
|
|
345
|
+
<thead>
|
|
346
|
+
<tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
|
|
347
|
+
</thead>
|
|
348
|
+
<tbody>
|
|
349
|
+
<tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android、iOS</td></tr>
|
|
350
|
+
</tbody>
|
|
351
|
+
</table>
|
|
352
|
+
|
|
353
|
+
<a id="showloading"></a>
|
|
354
|
+
### showLoading()
|
|
355
|
+
|
|
356
|
+
# showLoading
|
|
357
|
+
|
|
358
|
+
显示 loading 提示框。
|
|
359
|
+
|
|
360
|
+
## 扫码预览
|
|
361
|
+

|
|
362
|
+
|
|
363
|
+
## 支持版本
|
|
364
|
+
|
|
365
|
+
前端库版本不低于 `0.0.26`。
|
|
366
|
+
|
|
367
|
+
## 支持平台
|
|
368
|
+
|
|
369
|
+
<table>
|
|
370
|
+
<thead>
|
|
371
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
372
|
+
</thead>
|
|
373
|
+
<tbody>
|
|
374
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
375
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
376
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
377
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
378
|
+
</tbody>
|
|
379
|
+
</table>
|
|
380
|
+
|
|
381
|
+
## 支持场景
|
|
382
|
+
|
|
383
|
+
<table>
|
|
384
|
+
<thead>
|
|
385
|
+
<tr><th>场景</th><th>支持情况</th></tr>
|
|
386
|
+
</thead>
|
|
387
|
+
<tbody>
|
|
388
|
+
<tr><td>页面</td><td>支持</td></tr>
|
|
389
|
+
<tr><td>卡片</td><td>不支持</td></tr>
|
|
390
|
+
</tbody>
|
|
391
|
+
</table>
|
|
392
|
+
|
|
393
|
+
## 使用说明
|
|
394
|
+
|
|
395
|
+
需调用 hideLoading 关闭。
|
|
396
|
+
|
|
397
|
+
- loading 展示后需调用 hideLoading 手动关闭。
|
|
398
|
+
|
|
399
|
+
## 调用方式
|
|
400
|
+
|
|
401
|
+
### 异步 API
|
|
402
|
+
|
|
403
|
+
```typescript
|
|
404
|
+
showLoading(params?: ShowLoadingParams): Promise<object>
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
## 入参
|
|
408
|
+
|
|
409
|
+
无。
|
|
410
|
+
|
|
411
|
+
## 调用示例
|
|
412
|
+
|
|
413
|
+
```typescript
|
|
414
|
+
import { hideLoading, showLoading } from '@doubao-dev/framework/api';
|
|
415
|
+
|
|
416
|
+
await showLoading();
|
|
417
|
+
await hideLoading();
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
## 成功返回
|
|
421
|
+
|
|
422
|
+
无返回字段。
|
|
423
|
+
|
|
424
|
+
## 错误处理
|
|
425
|
+
|
|
426
|
+
错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
|
|
427
|
+
|
|
428
|
+
### 错误码
|
|
429
|
+
|
|
430
|
+
#### 通用错误码
|
|
431
|
+
|
|
432
|
+
<table>
|
|
433
|
+
<thead>
|
|
434
|
+
<tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
|
|
435
|
+
</thead>
|
|
436
|
+
<tbody>
|
|
437
|
+
<tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android、iOS</td></tr>
|
|
438
|
+
</tbody>
|
|
439
|
+
</table>
|
|
440
|
+
|
|
441
|
+
<a id="hidetoast"></a>
|
|
442
|
+
### hideToast()
|
|
443
|
+
|
|
444
|
+
# hideToast
|
|
445
|
+
|
|
446
|
+
隐藏当前 Toast。
|
|
447
|
+
|
|
448
|
+
## 扫码预览
|
|
449
|
+

|
|
450
|
+
|
|
451
|
+
## 支持版本
|
|
452
|
+
|
|
453
|
+
前端库版本不低于 `0.0.26`。
|
|
454
|
+
|
|
455
|
+
## 支持平台
|
|
456
|
+
|
|
457
|
+
<table>
|
|
458
|
+
<thead>
|
|
459
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
460
|
+
</thead>
|
|
461
|
+
<tbody>
|
|
462
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
463
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
464
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
465
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
466
|
+
</tbody>
|
|
467
|
+
</table>
|
|
468
|
+
|
|
469
|
+
## 支持场景
|
|
470
|
+
|
|
471
|
+
<table>
|
|
472
|
+
<thead>
|
|
473
|
+
<tr><th>场景</th><th>支持情况</th></tr>
|
|
474
|
+
</thead>
|
|
475
|
+
<tbody>
|
|
476
|
+
<tr><td>页面</td><td>支持</td></tr>
|
|
477
|
+
<tr><td>卡片</td><td>支持</td></tr>
|
|
478
|
+
</tbody>
|
|
479
|
+
</table>
|
|
480
|
+
|
|
481
|
+
## 使用说明
|
|
482
|
+
|
|
483
|
+
- 当前没有 Toast 时调用无副作用。
|
|
484
|
+
|
|
485
|
+
## 调用方式
|
|
486
|
+
|
|
487
|
+
### 异步 API
|
|
488
|
+
|
|
489
|
+
```typescript
|
|
490
|
+
hideToast(params?: HideInteractionParams): Promise<object>
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
## 入参
|
|
494
|
+
|
|
495
|
+
无。
|
|
496
|
+
|
|
497
|
+
## 调用示例
|
|
498
|
+
|
|
499
|
+
```typescript
|
|
500
|
+
import { hideToast } from '@doubao-dev/framework/api';
|
|
501
|
+
|
|
502
|
+
await hideToast();
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
## 成功返回
|
|
506
|
+
|
|
507
|
+
无返回字段。
|
|
508
|
+
|
|
509
|
+
## 错误处理
|
|
510
|
+
|
|
511
|
+
错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
|
|
512
|
+
|
|
513
|
+
### 错误码
|
|
514
|
+
|
|
515
|
+
#### 通用错误码
|
|
516
|
+
|
|
517
|
+
<table>
|
|
518
|
+
<thead>
|
|
519
|
+
<tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
|
|
520
|
+
</thead>
|
|
521
|
+
<tbody>
|
|
522
|
+
<tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android</td></tr>
|
|
523
|
+
</tbody>
|
|
524
|
+
</table>
|
|
525
|
+
|
|
526
|
+
<a id="hideloading"></a>
|
|
527
|
+
### hideLoading()
|
|
528
|
+
|
|
529
|
+
# hideLoading
|
|
530
|
+
|
|
531
|
+
隐藏当前 loading。
|
|
532
|
+
|
|
533
|
+
## 扫码预览
|
|
534
|
+

|
|
535
|
+
|
|
536
|
+
## 支持版本
|
|
537
|
+
|
|
538
|
+
前端库版本不低于 `0.0.26`。
|
|
539
|
+
|
|
540
|
+
## 支持平台
|
|
541
|
+
|
|
542
|
+
<table>
|
|
543
|
+
<thead>
|
|
544
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
545
|
+
</thead>
|
|
546
|
+
<tbody>
|
|
547
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
548
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
549
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
550
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
551
|
+
</tbody>
|
|
552
|
+
</table>
|
|
553
|
+
|
|
554
|
+
## 支持场景
|
|
555
|
+
|
|
556
|
+
<table>
|
|
557
|
+
<thead>
|
|
558
|
+
<tr><th>场景</th><th>支持情况</th></tr>
|
|
559
|
+
</thead>
|
|
560
|
+
<tbody>
|
|
561
|
+
<tr><td>页面</td><td>支持</td></tr>
|
|
562
|
+
<tr><td>卡片</td><td>不支持</td></tr>
|
|
563
|
+
</tbody>
|
|
564
|
+
</table>
|
|
565
|
+
|
|
566
|
+
## 使用说明
|
|
567
|
+
|
|
568
|
+
- 与 showLoading 配对使用;当前没有 loading 时调用无副作用。
|
|
569
|
+
|
|
570
|
+
## 调用方式
|
|
571
|
+
|
|
572
|
+
### 异步 API
|
|
573
|
+
|
|
574
|
+
```typescript
|
|
575
|
+
hideLoading(params?: HideInteractionParams): Promise<object>
|
|
576
|
+
```
|
|
577
|
+
|
|
578
|
+
## 入参
|
|
579
|
+
|
|
580
|
+
无。
|
|
581
|
+
|
|
582
|
+
## 调用示例
|
|
583
|
+
|
|
584
|
+
```typescript
|
|
585
|
+
import { hideLoading } from '@doubao-dev/framework/api';
|
|
586
|
+
|
|
587
|
+
await hideLoading();
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
## 成功返回
|
|
591
|
+
|
|
592
|
+
无返回字段。
|
|
593
|
+
|
|
594
|
+
<a id="showactionsheet"></a>
|
|
595
|
+
### showActionSheet()
|
|
596
|
+
|
|
597
|
+
# showActionSheet
|
|
598
|
+
|
|
599
|
+
显示操作菜单。
|
|
600
|
+
|
|
601
|
+
## 扫码预览
|
|
602
|
+

|
|
603
|
+
|
|
604
|
+
## 支持版本
|
|
605
|
+
|
|
606
|
+
前端库版本不低于 `0.0.26`。
|
|
607
|
+
|
|
608
|
+
## 支持平台
|
|
609
|
+
|
|
610
|
+
<table>
|
|
611
|
+
<thead>
|
|
612
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
613
|
+
</thead>
|
|
614
|
+
<tbody>
|
|
615
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
616
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
617
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
618
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
619
|
+
</tbody>
|
|
620
|
+
</table>
|
|
621
|
+
|
|
622
|
+
## 支持场景
|
|
623
|
+
|
|
624
|
+
<table>
|
|
625
|
+
<thead>
|
|
626
|
+
<tr><th>场景</th><th>支持情况</th></tr>
|
|
627
|
+
</thead>
|
|
628
|
+
<tbody>
|
|
629
|
+
<tr><td>页面</td><td>支持</td></tr>
|
|
630
|
+
<tr><td>卡片</td><td>支持</td></tr>
|
|
631
|
+
</tbody>
|
|
632
|
+
</table>
|
|
633
|
+
|
|
634
|
+
## 使用说明
|
|
635
|
+
|
|
636
|
+
- itemList 必填;用户点击菜单外区域取消时 Promise reject,请在 catch 中处理取消场景。
|
|
637
|
+
|
|
638
|
+
## 调用方式
|
|
639
|
+
|
|
640
|
+
### 异步 API
|
|
641
|
+
|
|
642
|
+
```typescript
|
|
643
|
+
showActionSheet(params: ShowActionSheetParams): Promise<ShowActionSheetResult>
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
## 入参
|
|
647
|
+
|
|
648
|
+
<table>
|
|
649
|
+
<thead>
|
|
650
|
+
<tr><th>名称</th><th>类型</th><th>必填</th><th>默认值</th><th>约束</th><th>说明</th></tr>
|
|
651
|
+
</thead>
|
|
652
|
+
<tbody>
|
|
653
|
+
<tr><td><code>itemColor</code></td><td><code>string</code></td><td>否</td><td><code>-</code></td><td>十六进制颜色字符串,例如 #000000。</td><td>按钮文字颜色。</td></tr>
|
|
654
|
+
<tr><td><code>itemList</code></td><td><code>string[]</code></td><td>是</td><td>-</td><td>-</td><td>按钮文字数组。</td></tr>
|
|
655
|
+
<tr><td><code>title</code></td><td><code>string</code></td><td>否</td><td><code>-</code></td><td>-</td><td>标题。</td></tr>
|
|
656
|
+
</tbody>
|
|
657
|
+
</table>
|
|
658
|
+
|
|
659
|
+
## 调用示例
|
|
660
|
+
|
|
661
|
+
```ts
|
|
662
|
+
import { showActionSheet } from '@doubao-dev/framework/api';
|
|
663
|
+
|
|
664
|
+
const result = await showActionSheet({
|
|
665
|
+
itemList: ['编辑', '删除']
|
|
666
|
+
});
|
|
667
|
+
|
|
668
|
+
console.log(result.tapIndex);
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
## 成功返回
|
|
672
|
+
|
|
673
|
+
<table>
|
|
674
|
+
<thead>
|
|
675
|
+
<tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
|
|
676
|
+
</thead>
|
|
677
|
+
<tbody>
|
|
678
|
+
<tr><td><code>tapIndex</code></td><td><code>number</code></td><td>是</td><td>用户点击的按钮序号,从 0 开始。</td></tr>
|
|
679
|
+
</tbody>
|
|
680
|
+
</table>
|
|
681
|
+
|
|
682
|
+
### 返回示例
|
|
683
|
+
|
|
684
|
+
```json
|
|
685
|
+
{
|
|
686
|
+
"tapIndex": 0
|
|
687
|
+
}
|
|
688
|
+
```
|
|
689
|
+
|
|
690
|
+
## 错误处理
|
|
691
|
+
|
|
692
|
+
错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
|
|
693
|
+
|
|
694
|
+
### 失败示例
|
|
695
|
+
|
|
696
|
+
```json
|
|
697
|
+
{
|
|
698
|
+
"errNo": 114,
|
|
699
|
+
"errMsg": "operation cancelled"
|
|
700
|
+
}
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
### 错误码
|
|
704
|
+
|
|
705
|
+
<table>
|
|
706
|
+
<thead>
|
|
707
|
+
<tr><th>errNo</th><th>errMsg</th><th>平台</th><th>触发条件</th><th>处理建议</th></tr>
|
|
708
|
+
</thead>
|
|
709
|
+
<tbody>
|
|
710
|
+
<tr><td><code>104</code></td><td><code>invalid parameter</code></td><td>Android、iOS</td><td>itemList 为空数组</td><td>传入至少一个菜单项后重试。</td></tr>
|
|
711
|
+
<tr><td><code>114</code></td><td><code>operation cancelled</code></td><td>Android、iOS</td><td>用户点击 Cancel 按钮或点击蒙层关闭操作菜单</td><td>用户主动取消,按需静默处理。</td></tr>
|
|
712
|
+
</tbody>
|
|
713
|
+
</table>
|
|
714
|
+
|
|
715
|
+
#### 通用错误码
|
|
716
|
+
|
|
717
|
+
<table>
|
|
718
|
+
<thead>
|
|
719
|
+
<tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
|
|
720
|
+
</thead>
|
|
721
|
+
<tbody>
|
|
722
|
+
<tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android、iOS</td></tr>
|
|
723
|
+
</tbody>
|
|
724
|
+
</table>
|
|
725
|
+
|
|
726
|
+
<a id="showbottomsheet"></a>
|
|
727
|
+
### showBottomSheet()
|
|
728
|
+
|
|
729
|
+
# showBottomSheet
|
|
730
|
+
|
|
731
|
+
显示豆包底部弹窗。
|
|
732
|
+
|
|
733
|
+
## 扫码预览
|
|
734
|
+

|
|
735
|
+
|
|
736
|
+
## 使用限制
|
|
737
|
+
|
|
738
|
+
> [!WARNING]
|
|
739
|
+
> **Android、iOS**:iOS 无法展示弹窗或不支持三按钮时返回 errNo 103 失败,Android 无法展示弹窗时返回 action=cancel、source=hostUnavailable 的成功结果,且不检测三按钮能力;调用方无法用统一逻辑处理弹窗不可用场景。
|
|
740
|
+
|
|
741
|
+
## 支持版本
|
|
742
|
+
|
|
743
|
+
前端库版本不低于 `0.0.36`。
|
|
744
|
+
|
|
745
|
+
## 支持平台
|
|
746
|
+
|
|
747
|
+
<table>
|
|
748
|
+
<thead>
|
|
749
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
750
|
+
</thead>
|
|
751
|
+
<tbody>
|
|
752
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
753
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
754
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
755
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
756
|
+
</tbody>
|
|
757
|
+
</table>
|
|
758
|
+
|
|
759
|
+
## 支持场景
|
|
760
|
+
|
|
761
|
+
<table>
|
|
762
|
+
<thead>
|
|
763
|
+
<tr><th>场景</th><th>支持情况</th></tr>
|
|
764
|
+
</thead>
|
|
765
|
+
<tbody>
|
|
766
|
+
<tr><td>页面</td><td>支持</td></tr>
|
|
767
|
+
<tr><td>卡片</td><td>支持</td></tr>
|
|
768
|
+
</tbody>
|
|
769
|
+
</table>
|
|
770
|
+
|
|
771
|
+
## 使用说明
|
|
772
|
+
|
|
773
|
+
`content` 接收受限 HTML 字符串,当前支持段落、加粗和链接;危险标签、事件属性和危险链接协议会被拦截。
|
|
774
|
+
链接会在豆包内打开,不会关闭弹窗。
|
|
775
|
+
Promise 在用户点击按钮或点击蒙层关闭后 resolve。
|
|
776
|
+
|
|
777
|
+
- content 为受限 HTML,仅支持段落、加粗和链接,危险标签、事件属性和非 http(s) 链接会被拦截并触发失败;链接点击打开 H5,不关闭弹窗。
|
|
778
|
+
- buttons 需 1-3 个且语义不重复;用户点击蒙层或下拉手势关闭时返回 action=cancel。当豆包无法展示弹窗时,iOS 返回失败、Android 返回 action=cancel 且 source=hostUnavailable,请对两种结果都做降级处理。
|
|
779
|
+
|
|
780
|
+
## 调用方式
|
|
781
|
+
|
|
782
|
+
### 异步 API
|
|
783
|
+
|
|
784
|
+
```typescript
|
|
785
|
+
showBottomSheet(params: ShowBottomSheetParams): Promise<ShowBottomSheetResult>
|
|
786
|
+
```
|
|
787
|
+
|
|
788
|
+
## 入参
|
|
789
|
+
|
|
790
|
+
<table>
|
|
791
|
+
<thead>
|
|
792
|
+
<tr><th>名称</th><th>类型</th><th>必填</th><th>默认值</th><th>约束</th><th>说明</th></tr>
|
|
793
|
+
</thead>
|
|
794
|
+
<tbody>
|
|
795
|
+
<tr><td><code>behavior</code></td><td><code>BottomSheetBehavior</code></td><td>否</td><td><code>-</code></td><td>-</td><td>弹窗行为配置。</td></tr>
|
|
796
|
+
<tr><td><code>behavior.dismissOnMaskTap</code></td><td><code>boolean</code></td><td>否</td><td><code>true</code></td><td>-</td><td>是否允许点击蒙层关闭弹窗。</td></tr>
|
|
797
|
+
<tr><td><code>buttons</code></td><td><code>BottomSheetButtons</code></td><td>是</td><td>-</td><td>-</td><td>按钮配置,支持 1-3 个,展示顺序与数组顺序一致,按钮语义不可重复。</td></tr>
|
|
798
|
+
<tr><td><code>content</code></td><td><code>string</code></td><td>是</td><td>-</td><td>-</td><td>受限 HTML 字符串,支持段落、加粗和链接。</td></tr>
|
|
799
|
+
<tr><td><code>title</code></td><td><code>string</code></td><td>是</td><td>-</td><td>-</td><td>弹窗标题。</td></tr>
|
|
800
|
+
</tbody>
|
|
801
|
+
</table>
|
|
802
|
+
|
|
803
|
+
## 调用示例
|
|
804
|
+
|
|
805
|
+
```ts
|
|
806
|
+
import { showBottomSheet } from '@doubao-dev/framework/api';
|
|
807
|
+
|
|
808
|
+
const result = await showBottomSheet({
|
|
809
|
+
title: '隐私协议提示',
|
|
810
|
+
content:
|
|
811
|
+
'<p>感谢您使用当前应用插件。</p><p><b>•</b> 详情请见<a href="https://www.doubao.com/chat/"><b>《应用插件条款》</b></a></p>',
|
|
812
|
+
buttons: [
|
|
813
|
+
{ role: 'agreeMain', text: '同意并继续' },
|
|
814
|
+
{ role: 'reject', text: '暂不同意' }
|
|
815
|
+
]
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
if (result.action === 'buttonClick') {
|
|
819
|
+
console.log(result.role);
|
|
820
|
+
}
|
|
821
|
+
```
|
|
822
|
+
|
|
823
|
+
## 成功返回
|
|
824
|
+
|
|
825
|
+
### `action = "buttonClick"`
|
|
826
|
+
|
|
827
|
+
<table>
|
|
828
|
+
<thead>
|
|
829
|
+
<tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
|
|
830
|
+
</thead>
|
|
831
|
+
<tbody>
|
|
832
|
+
<tr><td><code>action</code></td><td><code>"buttonClick"</code></td><td>是</td><td>弹窗结束动作。</td></tr>
|
|
833
|
+
<tr><td><code>role</code></td><td><code>BottomSheetButtonRole</code></td><td>是</td><td>被点击按钮的语义。</td></tr>
|
|
834
|
+
</tbody>
|
|
835
|
+
</table>
|
|
836
|
+
|
|
837
|
+
### `action = "cancel"`
|
|
838
|
+
|
|
839
|
+
<table>
|
|
840
|
+
<thead>
|
|
841
|
+
<tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
|
|
842
|
+
</thead>
|
|
843
|
+
<tbody>
|
|
844
|
+
<tr><td><code>action</code></td><td><code>"cancel"</code></td><td>是</td><td>弹窗结束动作。</td></tr>
|
|
845
|
+
<tr><td><code>source</code></td><td><code>BottomSheetCancelSource</code></td><td>是</td><td>取消来源。</td></tr>
|
|
846
|
+
</tbody>
|
|
847
|
+
</table>
|
|
848
|
+
|
|
849
|
+
### 返回示例
|
|
850
|
+
|
|
851
|
+
```json
|
|
852
|
+
{
|
|
853
|
+
"action": "buttonClick",
|
|
854
|
+
"role": "agreeMain"
|
|
855
|
+
}
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
## 错误处理
|
|
859
|
+
|
|
860
|
+
错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
|
|
861
|
+
|
|
862
|
+
### 失败示例
|
|
863
|
+
|
|
864
|
+
```json
|
|
865
|
+
{
|
|
866
|
+
"errNo": 104,
|
|
867
|
+
"errMsg": "invalid parameter"
|
|
868
|
+
}
|
|
869
|
+
```
|
|
870
|
+
|
|
871
|
+
### 错误码
|
|
872
|
+
|
|
873
|
+
<table>
|
|
874
|
+
<thead>
|
|
875
|
+
<tr><th>errNo</th><th>errMsg</th><th>平台</th><th>触发条件</th><th>处理建议</th></tr>
|
|
876
|
+
</thead>
|
|
877
|
+
<tbody>
|
|
878
|
+
<tr><td><code>104</code></td><td><code>invalid parameter</code></td><td>Android、iOS</td><td>title 或 content 为空、content 含被拦截的标签/事件属性/危险链接、buttons 数量不在 1-3 范围;iOS 还会在按钮语义重复或按钮文案为空时返回</td><td>修正参数后重试。</td></tr>
|
|
879
|
+
<tr><td><code>103</code></td><td><code>feature not support</code></td><td>iOS</td><td>豆包 iOS 无法展示底部弹窗,或不支持包含 3 个按钮的弹窗</td><td>降级到自定义弹窗;同场景 Android 返回 action=cancel、source=hostUnavailable 的成功结果,请一并做降级处理。</td></tr>
|
|
880
|
+
</tbody>
|
|
881
|
+
</table>
|
|
882
|
+
|
|
883
|
+
## 平台差异
|
|
884
|
+
|
|
885
|
+
- **iOS**:无法展示底部弹窗或不支持三按钮时返回 errNo 103 失败;Android 无法展示底部弹窗时返回 action=cancel、source=hostUnavailable 的成功结果,且不校验三按钮能力。
|
|
886
|
+
|
|
887
|
+
<a id="getmenubuttonboundingclientrect"></a>
|
|
888
|
+
### getMenuButtonBoundingClientRect()
|
|
889
|
+
|
|
890
|
+
# getMenuButtonBoundingClientRect
|
|
891
|
+
|
|
892
|
+
取菜单按钮(右上角胶囊按钮)的布局位置信息。
|
|
893
|
+
|
|
894
|
+
## 扫码预览
|
|
895
|
+

|
|
896
|
+
|
|
897
|
+
## 支持版本
|
|
898
|
+
|
|
899
|
+
前端库版本不低于 `0.0.26`。
|
|
900
|
+
|
|
901
|
+
## 支持平台
|
|
902
|
+
|
|
903
|
+
<table>
|
|
904
|
+
<thead>
|
|
905
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
906
|
+
</thead>
|
|
907
|
+
<tbody>
|
|
908
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
909
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
910
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
911
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
912
|
+
</tbody>
|
|
913
|
+
</table>
|
|
914
|
+
|
|
915
|
+
## 支持场景
|
|
916
|
+
|
|
917
|
+
<table>
|
|
918
|
+
<thead>
|
|
919
|
+
<tr><th>场景</th><th>支持情况</th></tr>
|
|
920
|
+
</thead>
|
|
921
|
+
<tbody>
|
|
922
|
+
<tr><td>页面</td><td>支持</td></tr>
|
|
923
|
+
<tr><td>卡片</td><td>不支持</td></tr>
|
|
924
|
+
</tbody>
|
|
925
|
+
</table>
|
|
926
|
+
|
|
927
|
+
## 使用说明
|
|
928
|
+
|
|
929
|
+
- 坐标单位为逻辑像素,与 CSS 像素一致,可直接用于页面布局定位。
|
|
930
|
+
|
|
931
|
+
## 调用方式
|
|
932
|
+
|
|
933
|
+
### 同步 API
|
|
934
|
+
|
|
935
|
+
```typescript
|
|
936
|
+
getMenuButtonBoundingClientRect(): MenuButtonBoundingClientRect
|
|
937
|
+
```
|
|
938
|
+
|
|
939
|
+
## 入参
|
|
940
|
+
|
|
941
|
+
无。
|
|
942
|
+
|
|
943
|
+
## 调用示例
|
|
944
|
+
|
|
945
|
+
```ts
|
|
946
|
+
import { getMenuButtonBoundingClientRect } from '@doubao-dev/framework/api';
|
|
947
|
+
|
|
948
|
+
const rect = getMenuButtonBoundingClientRect();
|
|
949
|
+
|
|
950
|
+
console.log(rect.width, rect.height);
|
|
951
|
+
console.log(rect.top, rect.right, rect.bottom, rect.left);
|
|
952
|
+
```
|
|
953
|
+
|
|
954
|
+
## 返回值
|
|
955
|
+
|
|
956
|
+
<table>
|
|
957
|
+
<thead>
|
|
958
|
+
<tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
|
|
959
|
+
</thead>
|
|
960
|
+
<tbody>
|
|
961
|
+
<tr><td><code>bottom</code></td><td><code>number</code></td><td>是</td><td>下边界坐标,单位 px。</td></tr>
|
|
962
|
+
<tr><td><code>height</code></td><td><code>number</code></td><td>是</td><td>高度,单位 px。</td></tr>
|
|
963
|
+
<tr><td><code>left</code></td><td><code>number</code></td><td>是</td><td>左边界坐标,单位 px。</td></tr>
|
|
964
|
+
<tr><td><code>right</code></td><td><code>number</code></td><td>是</td><td>右边界坐标,单位 px。</td></tr>
|
|
965
|
+
<tr><td><code>top</code></td><td><code>number</code></td><td>是</td><td>上边界坐标,单位 px。</td></tr>
|
|
966
|
+
<tr><td><code>width</code></td><td><code>number</code></td><td>是</td><td>宽度,单位 px。</td></tr>
|
|
967
|
+
</tbody>
|
|
968
|
+
</table>
|
|
969
|
+
|
|
970
|
+
### 返回示例
|
|
971
|
+
|
|
972
|
+
```json
|
|
973
|
+
{
|
|
974
|
+
"width": 84,
|
|
975
|
+
"height": 36,
|
|
976
|
+
"top": 48,
|
|
977
|
+
"right": 363,
|
|
978
|
+
"bottom": 84,
|
|
979
|
+
"left": 279
|
|
980
|
+
}
|
|
981
|
+
```
|
|
982
|
+
|
|
983
|
+
<a id="showtoast"></a>
|
|
984
|
+
### showToast()
|
|
985
|
+
|
|
986
|
+
# showToast
|
|
987
|
+
|
|
988
|
+
显示 Toast 提示。
|
|
989
|
+
|
|
990
|
+
## 扫码预览
|
|
991
|
+

|
|
992
|
+
|
|
993
|
+
## 使用限制
|
|
994
|
+
|
|
995
|
+
> [!WARNING]
|
|
996
|
+
> **Android、iOS**:Android、iOS 均只按 icon/type 渲染内置图标,不加载 customIcon;依赖 customIcon 展示图标的调用不会生效。
|
|
997
|
+
|
|
998
|
+
## 支持版本
|
|
999
|
+
|
|
1000
|
+
前端库版本不低于 `0.0.9`。
|
|
1001
|
+
|
|
1002
|
+
## 支持平台
|
|
1003
|
+
|
|
1004
|
+
<table>
|
|
1005
|
+
<thead>
|
|
1006
|
+
<tr><th>平台</th><th>支持情况</th></tr>
|
|
1007
|
+
</thead>
|
|
1008
|
+
<tbody>
|
|
1009
|
+
<tr><td>Android</td><td>支持</td></tr>
|
|
1010
|
+
<tr><td>iOS</td><td>支持</td></tr>
|
|
1011
|
+
<tr><td>PC</td><td>不支持</td></tr>
|
|
1012
|
+
<tr><td>HarmonyOS</td><td>不支持</td></tr>
|
|
1013
|
+
</tbody>
|
|
1014
|
+
</table>
|
|
1015
|
+
|
|
1016
|
+
## 支持场景
|
|
1017
|
+
|
|
1018
|
+
<table>
|
|
1019
|
+
<thead>
|
|
1020
|
+
<tr><th>场景</th><th>支持情况</th></tr>
|
|
1021
|
+
</thead>
|
|
1022
|
+
<tbody>
|
|
1023
|
+
<tr><td>页面</td><td>支持</td></tr>
|
|
1024
|
+
<tr><td>卡片</td><td>支持</td></tr>
|
|
1025
|
+
</tbody>
|
|
1026
|
+
</table>
|
|
1027
|
+
|
|
1028
|
+
## 使用说明
|
|
1029
|
+
|
|
1030
|
+
Android 默认显示 3000 毫秒,iOS 默认显示 2000 毫秒;需要双端一致时请显式传入 `duration`。
|
|
1031
|
+
|
|
1032
|
+
- message 必填,且 type 与 icon 至少传一个;customIcon 当前不会渲染,请通过 icon 使用内置图标。
|
|
1033
|
+
|
|
1034
|
+
## 调用方式
|
|
1035
|
+
|
|
1036
|
+
### 异步 API
|
|
1037
|
+
|
|
1038
|
+
```typescript
|
|
1039
|
+
showToast(params: ShowToastParams): Promise<object>
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
## 入参
|
|
1043
|
+
|
|
1044
|
+
<table>
|
|
1045
|
+
<thead>
|
|
1046
|
+
<tr><th>名称</th><th>类型</th><th>必填</th><th>默认值</th><th>约束</th><th>说明</th></tr>
|
|
1047
|
+
</thead>
|
|
1048
|
+
<tbody>
|
|
1049
|
+
<tr><td><code>customIcon</code></td><td><code>string</code></td><td>否</td><td><code>-</code></td><td>-</td><td>自定义图标的 URL 或 base64 字符串。Android、iOS:Android、iOS 均只按 icon/type 渲染内置图标,不加载 customIcon。</td></tr>
|
|
1050
|
+
<tr><td><code>duration</code></td><td><code>number</code></td><td>否</td><td><code>Android 3000,iOS 2000</code></td><td>需双端保持一致时请显式传入。</td><td>提示的持续时间,单位毫秒。</td></tr>
|
|
1051
|
+
<tr><td><code>icon</code></td><td><code>"success" | "error" | "warn"</code></td><td>否</td><td><code>-</code></td><td>-</td><td>图标。</td></tr>
|
|
1052
|
+
<tr><td><code>message</code></td><td><code>string</code></td><td>是</td><td>-</td><td>-</td><td>提示的内容。</td></tr>
|
|
1053
|
+
<tr><td><code>type</code></td><td><code>"default" | "success" | "error" | "warning"</code></td><td>否</td><td><code>'default'</code></td><td>-</td><td>Toast 的类型。</td></tr>
|
|
1054
|
+
</tbody>
|
|
1055
|
+
</table>
|
|
1056
|
+
|
|
1057
|
+
## 调用示例
|
|
1058
|
+
|
|
1059
|
+
```typescript
|
|
1060
|
+
import { showToast } from '@doubao-dev/framework/api';
|
|
1061
|
+
|
|
1062
|
+
// 显示一个成功的 Toast
|
|
1063
|
+
showToast({
|
|
1064
|
+
message: '操作成功',
|
|
1065
|
+
type: 'success',
|
|
1066
|
+
icon: 'success',
|
|
1067
|
+
duration: 1500
|
|
1068
|
+
}).then(() => {
|
|
1069
|
+
console.log('Toast 显示完毕');
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
// 显示一个错误的 Toast
|
|
1073
|
+
showToast({
|
|
1074
|
+
message: '网络错误',
|
|
1075
|
+
type: 'error',
|
|
1076
|
+
icon: 'error'
|
|
1077
|
+
});
|
|
1078
|
+
```
|
|
1079
|
+
|
|
1080
|
+
## 成功返回
|
|
1081
|
+
|
|
1082
|
+
无返回字段。
|
|
1083
|
+
|
|
1084
|
+
### 返回示例
|
|
1085
|
+
|
|
1086
|
+
```json
|
|
1087
|
+
{}
|
|
1088
|
+
```
|
|
1089
|
+
|
|
1090
|
+
## 错误处理
|
|
1091
|
+
|
|
1092
|
+
错误对象和通用错误码见 [通用错误处理](./common-errors.md#错误返回)。
|
|
1093
|
+
|
|
1094
|
+
### 失败示例
|
|
1095
|
+
|
|
1096
|
+
```json
|
|
1097
|
+
{
|
|
1098
|
+
"errNo": 104,
|
|
1099
|
+
"errMsg": "invalid parameter"
|
|
1100
|
+
}
|
|
1101
|
+
```
|
|
1102
|
+
|
|
1103
|
+
### 错误码
|
|
1104
|
+
|
|
1105
|
+
<table>
|
|
1106
|
+
<thead>
|
|
1107
|
+
<tr><th>errNo</th><th>errMsg</th><th>平台</th><th>触发条件</th><th>处理建议</th></tr>
|
|
1108
|
+
</thead>
|
|
1109
|
+
<tbody>
|
|
1110
|
+
<tr><td><code>104</code></td><td><code>invalid parameter</code></td><td>Android、iOS</td><td>message 为空;iOS 还会在 icon 取值非法或入参无法解析时返回(type 由前端归一化为合法值,非法 type 场景不会触发)</td><td>修正参数后重试。</td></tr>
|
|
1111
|
+
<tr><td><code>103</code></td><td><code>feature not support</code></td><td>iOS</td><td>豆包 UIService 未实现,无法展示 Toast</td><td>降级到其他提示方式。</td></tr>
|
|
1112
|
+
</tbody>
|
|
1113
|
+
</table>
|
|
1114
|
+
|
|
1115
|
+
#### 通用错误码
|
|
1116
|
+
|
|
1117
|
+
<table>
|
|
1118
|
+
<thead>
|
|
1119
|
+
<tr><th>errNo</th><th>errMsg</th><th>说明</th><th>平台</th></tr>
|
|
1120
|
+
</thead>
|
|
1121
|
+
<tbody>
|
|
1122
|
+
<tr><td><code>102</code></td><td><code>internal error</code></td><td>内部错误</td><td>Android</td></tr>
|
|
1123
|
+
</tbody>
|
|
1124
|
+
</table>
|
|
1125
|
+
|
|
1126
|
+
## 平台差异
|
|
1127
|
+
|
|
1128
|
+
- **iOS**:参数校验失败统一返回 errNo 104;UIService 缺失时返回 errNo 103。Android 参数校验失败返回 errNo 104,豆包页面运行上下文缺失返回 errNo 102。
|
|
1129
|
+
|
|
1130
|
+
## 相关类型
|
|
1131
|
+
|
|
1132
|
+
<a id="enablealertbeforeunloadparams"></a>
|
|
1133
|
+
### EnableAlertBeforeUnloadParams
|
|
1134
|
+
|
|
1135
|
+
开启返回前提醒的参数。
|
|
1136
|
+
|
|
1137
|
+
#### Properties
|
|
1138
|
+
|
|
1139
|
+
• **message**: `string` - 返回前确认弹窗的文案
|
|
1140
|
+
|
|
1141
|
+
<a id="showmodalparams"></a>
|
|
1142
|
+
### ShowModalParams
|
|
1143
|
+
|
|
1144
|
+
显示模态对话框的参数。
|
|
1145
|
+
|
|
1146
|
+
#### Properties
|
|
1147
|
+
|
|
1148
|
+
• **title?**: `string` - 模态对话框的标题
|
|
1149
|
+
• **content?**: `string` - 模态对话框的内容
|
|
1150
|
+
• **showCancel?**: `boolean` - 是否显示取消按钮
|
|
1151
|
+
• **cancelText?**: `string` - 取消按钮的文字
|
|
1152
|
+
• **cancelColor?**: `string` - 取消按钮的文字颜色
|
|
1153
|
+
• **confirmText?**: `string` - 确认按钮的文字
|
|
1154
|
+
• **confirmColor?**: `string` - 确认按钮的文字颜色
|
|
1155
|
+
• **editable?**: `boolean` - 是否显示输入框
|
|
1156
|
+
• **placeholderText?**: `string` - 显示输入框时的提示文本
|
|
1157
|
+
• **tapMaskToDismiss?**: `boolean` - 是否允许点击蒙层关闭对话框
|
|
1158
|
+
|
|
1159
|
+
<a id="showmodalresult"></a>
|
|
1160
|
+
### ShowModalResult
|
|
1161
|
+
|
|
1162
|
+
显示模态对话框的返回结果。
|
|
1163
|
+
|
|
1164
|
+
#### Properties
|
|
1165
|
+
|
|
1166
|
+
• **action**: `'confirm' | 'cancel' | 'mask'` - 用户点击的动作
|
|
1167
|
+
• **content?**: `string` - editable 为 true 时,用户点击确认后输入的文本
|
|
1168
|
+
|
|
1169
|
+
<a id="showloadingparams"></a>
|
|
1170
|
+
### ShowLoadingParams
|
|
1171
|
+
|
|
1172
|
+
显示 loading 提示框的参数。
|
|
1173
|
+
|
|
1174
|
+
#### Properties
|
|
1175
|
+
|
|
1176
|
+
无字段。
|
|
1177
|
+
|
|
1178
|
+
<a id="hideinteractionparams"></a>
|
|
1179
|
+
### HideInteractionParams
|
|
1180
|
+
|
|
1181
|
+
隐藏交互提示框的公共参数。
|
|
1182
|
+
|
|
1183
|
+
#### Properties
|
|
1184
|
+
|
|
1185
|
+
无字段。
|
|
1186
|
+
|
|
1187
|
+
<a id="showactionsheetparams"></a>
|
|
1188
|
+
### ShowActionSheetParams
|
|
1189
|
+
|
|
1190
|
+
显示操作菜单的参数。
|
|
1191
|
+
|
|
1192
|
+
#### Properties
|
|
1193
|
+
|
|
1194
|
+
• **title?**: `string` - 标题
|
|
1195
|
+
• **itemList**: `string[]` - 按钮文字数组
|
|
1196
|
+
• **itemColor?**: `string` - 按钮文字颜色
|
|
1197
|
+
|
|
1198
|
+
<a id="showactionsheetresult"></a>
|
|
1199
|
+
### ShowActionSheetResult
|
|
1200
|
+
|
|
1201
|
+
显示操作菜单的返回结果。
|
|
1202
|
+
|
|
1203
|
+
#### Properties
|
|
1204
|
+
|
|
1205
|
+
• **tapIndex**: `number` - 用户点击的按钮序号,从 0 开始
|
|
1206
|
+
|
|
1207
|
+
<a id="bottomsheetbuttonrole"></a>
|
|
1208
|
+
### BottomSheetButtonRole
|
|
1209
|
+
|
|
1210
|
+
底部弹窗按钮语义。
|
|
1211
|
+
|
|
1212
|
+
#### Type
|
|
1213
|
+
|
|
1214
|
+
`'agreeMain' | 'agreeSub' | 'reject'`
|
|
1215
|
+
|
|
1216
|
+
<a id="bottomsheetcancelsource"></a>
|
|
1217
|
+
### BottomSheetCancelSource
|
|
1218
|
+
|
|
1219
|
+
底部弹窗取消来源。
|
|
1220
|
+
|
|
1221
|
+
#### Type
|
|
1222
|
+
|
|
1223
|
+
`'mask' | 'gesture' | 'hostUnavailable' | 'unknown'`
|
|
1224
|
+
|
|
1225
|
+
<a id="bottomsheetbuttons"></a>
|
|
1226
|
+
### BottomSheetButtons
|
|
1227
|
+
|
|
1228
|
+
底部弹窗按钮配置,支持 1-3 个按钮。
|
|
1229
|
+
|
|
1230
|
+
#### Type
|
|
1231
|
+
|
|
1232
|
+
`| [BottomSheetButton]
|
|
1233
|
+
| [BottomSheetButton, BottomSheetButton]
|
|
1234
|
+
| [BottomSheetButton, BottomSheetButton, BottomSheetButton]`
|
|
1235
|
+
|
|
1236
|
+
<a id="bottomsheetbehavior"></a>
|
|
1237
|
+
### BottomSheetBehavior
|
|
1238
|
+
|
|
1239
|
+
底部弹窗行为配置。
|
|
1240
|
+
|
|
1241
|
+
#### Properties
|
|
1242
|
+
|
|
1243
|
+
• **dismissOnMaskTap?**: `boolean` - 是否允许点击蒙层关闭弹窗
|
|
1244
|
+
|
|
1245
|
+
<a id="showbottomsheetparams"></a>
|
|
1246
|
+
### ShowBottomSheetParams
|
|
1247
|
+
|
|
1248
|
+
显示底部弹窗的参数。
|
|
1249
|
+
|
|
1250
|
+
#### Properties
|
|
1251
|
+
|
|
1252
|
+
• **title**: `string` - 弹窗标题
|
|
1253
|
+
• **content**: `string` - 受限 HTML 字符串,支持段落、加粗和链接
|
|
1254
|
+
• **buttons**: `BottomSheetButtons` - 按钮配置,支持 1-3 个,展示顺序与数组顺序一致,按钮语义不可重复
|
|
1255
|
+
• **behavior?**: `BottomSheetBehavior` - 弹窗行为配置
|
|
1256
|
+
|
|
1257
|
+
<a id="showbottomsheetresult"></a>
|
|
1258
|
+
### ShowBottomSheetResult
|
|
1259
|
+
|
|
1260
|
+
显示底部弹窗的返回结果。
|
|
1261
|
+
|
|
1262
|
+
#### Type
|
|
1263
|
+
|
|
1264
|
+
`BottomSheetButtonClickResult | BottomSheetCancelResult`
|
|
1265
|
+
|
|
1266
|
+
<a id="bottomsheetbutton"></a>
|
|
1267
|
+
### BottomSheetButton
|
|
1268
|
+
|
|
1269
|
+
底部弹窗按钮配置。
|
|
1270
|
+
|
|
1271
|
+
#### Properties
|
|
1272
|
+
|
|
1273
|
+
• **role**: `BottomSheetButtonRole` - 按钮语义
|
|
1274
|
+
• **text**: `string` - 按钮展示文案
|
|
1275
|
+
|
|
1276
|
+
<a id="bottomsheetbuttonclickresult"></a>
|
|
1277
|
+
### BottomSheetButtonClickResult
|
|
1278
|
+
|
|
1279
|
+
底部弹窗点击按钮的返回结果。
|
|
1280
|
+
|
|
1281
|
+
#### Properties
|
|
1282
|
+
|
|
1283
|
+
• **action**: `'buttonClick'` - 弹窗结束动作
|
|
1284
|
+
• **role**: `BottomSheetButtonRole` - 被点击按钮的语义
|
|
1285
|
+
|
|
1286
|
+
<a id="bottomsheetcancelresult"></a>
|
|
1287
|
+
### BottomSheetCancelResult
|
|
1288
|
+
|
|
1289
|
+
底部弹窗取消关闭的返回结果。
|
|
1290
|
+
|
|
1291
|
+
#### Properties
|
|
1292
|
+
|
|
1293
|
+
• **action**: `'cancel'` - 弹窗结束动作
|
|
1294
|
+
• **source**: `BottomSheetCancelSource` - 取消来源
|
|
1295
|
+
|
|
1296
|
+
<a id="menubuttonboundingclientrect"></a>
|
|
1297
|
+
### MenuButtonBoundingClientRect
|
|
1298
|
+
|
|
1299
|
+
菜单按钮的布局位置信息。
|
|
1300
|
+
|
|
1301
|
+
#### Properties
|
|
1302
|
+
|
|
1303
|
+
• **width**: `number` - 宽度,单位 px
|
|
1304
|
+
• **height**: `number` - 高度,单位 px
|
|
1305
|
+
• **top**: `number` - 上边界坐标,单位 px
|
|
1306
|
+
• **right**: `number` - 右边界坐标,单位 px
|
|
1307
|
+
• **bottom**: `number` - 下边界坐标,单位 px
|
|
1308
|
+
• **left**: `number` - 左边界坐标,单位 px
|
|
1309
|
+
|
|
1310
|
+
<a id="showtoastparams"></a>
|
|
1311
|
+
### ShowToastParams
|
|
1312
|
+
|
|
1313
|
+
#### Properties
|
|
1314
|
+
|
|
1315
|
+
• **message**: `string` - 提示的内容
|
|
1316
|
+
• **type?**: `'default' | 'success' | 'error' | 'warning'` - Toast 的类型
|
|
1317
|
+
• **duration?**: `number` - 提示的持续时间,单位毫秒
|
|
1318
|
+
• **icon?**: `'success' | 'error' | 'warn'` - 图标
|
|
1319
|
+
• **customIcon?**: `string` - 自定义图标的 URL 或 base64 字符串
|