Socket
Socket
Sign inDemoInstall

toast-dialog

Package Overview
Dependencies
181
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    toast-dialog

基于vant2.x的一款轻提示、弹窗一体化组件


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

toast-dialog

安装 npm 包

npm install toast-dialog

导入 CToast

import CToast from 'toast-dialog';

初始化对象

const cToast = new CToast({
  title: '温馨提示', // 弹窗标题
  buttonText: '我明白了', // 弹窗按钮文本
  messageAlign: 'left', // 弹窗内容对齐方式
  textLength: 20, // 超出自动以弹窗方式展示的字符数  1个中文=2个字符
  duration: 2000, // 轻提示自动关闭 毫秒数
});

使用 success 方法

cToast.success('这是一段成功的提示内容!'), // 通过字数自动调整展示方式
cToast.success('这是一段成功的提示内容!', 'toast'), // 强制使用toast方式展示
cToast.success('这是一段成功的提示内容!', 'dialog'), // 强制使用dialog方式展示

使用 fail 方法

cToast.fail('这是一段失败的提示内容!'), // 通过字数自动调整展示方式
cToast.fail('这是一段失败的提示内容!', 'toast'), // 强制使用toast方式展示
cToast.fail('这是一段失败的提示内容!', 'dialog'), // 强制使用dialog方式展示

使用 warning 方法

cToast.warning('这是一段警告的提示内容!'), // 通过字数自动调整展示方式
cToast.warning('这是一段警告的提示内容!', 'toast'), // 强制使用toast方式展示
cToast.warning('这是一段警告的提示内容!', 'dialog'), // 强制使用dialog方式展示

Keywords

FAQs

Last updated on 29 Dec 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc