1.3.3 • Published 10 months ago

lbl-toast v1.3.3

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

lbl-toast

基于 Svelte 构建的 Toast 组件,不依赖任何框架。

安装

npm install lbl-toast
yarn add lbl-toast

or

<head>
  <link rel="stylesheet" href="../dist/index.css" />
  <script defer src="../dist/index.js"></script>
</head>

<script>
  Toast.info("哈哈哈哈")
</script>

在线预览

在线预览 Demo

使用方式

import "lbl-toast/dist/index.css"
import Toast from "lbl-toast"

// 全局配置
Toast.config({
  duration: 3000  // 3秒,
  forbidClick: true // 禁止背景点击
  zIndex: 999999  // z-index 层级
})

// 默认 duration 1500 毫秒
// 默认背景可点击
Toast.info("普通信息 toast")
Toast.error("异常信息 toast")
// forbidClick: 禁止背景点击
Toast.success("成功信息 toast", { duration: 300, forbidClick: true })
Toast.warning("警告信息 toast", { duration: 1500 })

// 加载弹窗
const { setText, clear } = Toast.loading()

// 关闭弹窗
Toast.clear()

// 动态更新文字
Toast.setText("动态更换文字")

参数

参数名描述类型
duration持续时间,0 或负值将永远显示,默认:1500,loading 模式默认为:-1number
forbidClick是否禁止背景点击,默认:false,loading 模式默认为:trueboolean
zIndexz-index 层级,默认:99999number

Toast.loading

参数名描述类型
text加载框提示文本string
style加载样式,共八种LoadingStyle

type LoadingStyle = "style0" | "style1" | "style2" | "style3" | "style4" | "style5" | "style6" | "style7"

1.2.0

10 months ago

1.1.0

10 months ago

1.3.3

10 months ago

1.3.2

10 months ago

1.3.1

10 months ago

1.3.0

10 months ago

1.2.1

10 months ago

1.0.0

3 years ago