跳到主要内容
版本:v2

提示框

Toast API 提供了一个通知弹出框,用于向用户显示重要信息。就像真正的吐司一样!

PWA 注意事项

Toast 插件需要 PWA Elements 才能工作。

示例

import { Plugins } from '@capacitor/core';
const { Toast } = Plugins;

async show() {
await Toast.show({
text: '你好!'
});
}

API

show(...)

show(options: ToastShowOptions) => Promise<void>
参数类型
options
ToastShowOptions

接口

ToastShowOptions

属性类型描述
textstring
duration"short" | "long"Toast 的持续时间,'short'(2000ms,默认)或 'long'(3500ms)
position"center" | "bottom" | "top"