0.0.4 • Published 1 year ago
@cjs-front-end/show-toast v0.0.4
@yipai-front-end/show-toast
介绍
通过函数的方式,唤起 toast 框,使用方法与微信小程序的 APIwx.showToast
类似。
0 依赖,10kb 以内的 toast 工具库
基本用法
安装
npm i @yipai-front-end/show-toast
使用示例
import { showToast } from '@yipai-front-end/show-toast'
let toast = showToast({
title: '这是一段提示',
icon: 'success',
})
// 直接停止
toast.close()
API
属性 | 类型 | 默认值 | 说明 |
---|---|---|---|
title | string | toast 提示文本 | |
icon | none|error|success | none | toast 类型 |
mask | boolean | true | toast 是否存在遮罩层 |
duration | number | 1500 | 持续时间 |
function
方法 | 返回值 | 说明 | |
---|---|---|---|
close | void | 手动关闭进行中的 toast |