Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dndc-medusa-wx-toast

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dndc-medusa-wx-toast

微信小程序统一Toast功能函数

  • 1.0.2
  • latest
  • npm
  • Socket score

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

medusa-wx-toast

日常开发中,wx.showToast 功能频繁的使用在 loading 与文本提示上,一般都会对该功能进行统一的封装。为了省去每个项目都需要封装一遍的麻烦,我将该功能提取为 medusa-wx-toast 工具包,该工具提供的功能如下:

参数描述

name参数类型默认值是否必填描述
messageString-提示文本
imageString-自定义图标的本地路径
durationNumber2000提示窗口停留持续时长(毫秒)
maskBooleantrue是否启用遮罩
successFunction-成功回调
failFunction-失败回调
completeFunction-完成回调

纯文本提示功能

/** 快捷调用形式 */
Toast('提示文本');

/** 完整形式 */
Toast({
  message: '提示文本',
  ...
});

Loading 提示功能

/** 快捷调用形式 */
Toast.loading('loading...');

/** 完整形式 */
Toast.loading({
  message: 'loading...',
  ...
});

更改默认设置

本工具提供更改预设参数值的功能,在 App 启动时调用 setDefaultOptions 方法可以更改预设的参数,并且在后续任何位置的使用都能继承这一更改。

App({
  onLaunch() {
    Toast.setDefaultOptions({ duration: 1500 });
  },
});

Keywords

FAQs

Package last updated on 11 Jul 2021

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc