Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
dndc-medusa-wx-toast
Advanced tools
日常开发中,wx.showToast
功能频繁的使用在 loading 与文本提示上,一般都会对该功能进行统一的封装。为了省去每个项目都需要封装一遍的麻烦,我将该功能提取为 medusa-wx-toast 工具包,该工具提供的功能如下:
name | 参数类型 | 默认值 | 是否必填 | 描述 |
---|---|---|---|---|
message | String | - | 是 | 提示文本 |
image | String | - | 否 | 自定义图标的本地路径 |
duration | Number | 2000 | 否 | 提示窗口停留持续时长(毫秒) |
mask | Boolean | true | 否 | 是否启用遮罩 |
success | Function | - | 否 | 成功回调 |
fail | Function | - | 否 | 失败回调 |
complete | Function | - | 否 | 完成回调 |
/** 快捷调用形式 */
Toast('提示文本');
/** 完整形式 */
Toast({
message: '提示文本',
...
});
/** 快捷调用形式 */
Toast.loading('loading...');
/** 完整形式 */
Toast.loading({
message: 'loading...',
...
});
本工具提供更改预设参数值的功能,在 App 启动时调用 setDefaultOptions
方法可以更改预设的参数,并且在后续任何位置的使用都能继承这一更改。
App({
onLaunch() {
Toast.setDefaultOptions({ duration: 1500 });
},
});
FAQs
微信小程序统一Toast功能函数
The npm package dndc-medusa-wx-toast receives a total of 0 weekly downloads. As such, dndc-medusa-wx-toast popularity was classified as not popular.
We found that dndc-medusa-wx-toast demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.