@capacitor/text-zoom
文本缩放 API 提供了更改 Web 视图文本大小以实现视觉辅助功能的能力。
注意: 除非在你的 Capacitor 配置文件中将 preferredContentMode 配置设置为 mobile,否则 text-zoom 插件在 iPad 上不起作用。
{
"ios": {
"preferredContentMode": "mobile"
}
}
安装
npm install @capacitor/text-zoom
npx cap sync
API
get()
get() => Promise<GetResult>
获取当前缩放级别。
缩放级别以小数表示(例如 1.2 是 120%)。
Returns:
Promise<GetResult>
Since: 1.0.0
getPreferred()
getPreferred() => Promise<GetPreferredResult>
获取首选缩放级别。
缩放级别以小数表示(例如 1.2 是 120%)。
Returns:
Promise<GetPreferredResult>
Since: 1.0.0
set(...)
set(options: SetOptions) => Promise<void>
设置当前缩放级别。
缩放级别以小数表示(例如 1.2 是 120%)。
| Param | Type |
|---|---|
options | |
Since: 1.0.0
Interfaces
GetResult
| Prop | Type | Description | Since |
|---|---|---|---|
value | number | 当前缩放级别(以小数表示)。 | 1.0.0 |
GetPreferredResult
| Prop | Type | Description | Since |
|---|---|---|---|
value | number | 首选缩放级别(以小数表示)。 | 1.0.0 |
SetOptions
| Prop | Type | Description | Since |
|---|---|---|---|
value | number | 新缩放级别(以小数表示)。 | 1.0.0 |