nativeScript-toasts
提供用于在 Android 和 iOS 上创建 toast 通知的通用 API
npm i --save nativescript-toasts

nativeScript-toasts

此插件为 Android 和 iOS 提供了在 NativeScript 应用程序中显示 toast 通知的通用 API。

安装

tns plugin add nativescript-toasts

如何使用

var nstoasts = require("nativescript-toasts");
var options = {
text: "Hello World",
duration : nstoasts.DURATION.SHORT,
position : nstoasts.POSITION.TOP //optional
}
nstoasts.show(options);

此插件使用第三方库进行 iOS 开发

插件使用由 Charles Scalesse 创建的 pod 在 iOS 上显示 toast

https://cocoapods.org.cn/pods/Toast

Typescript 用户

import * as Toast from 'nativescript-toasts';

let toastOptions:Toast.ToastOptions = {text: "Hello World", dutation: Toast.DURATION.SHORT};
Toast.show(toastOptions);