├── LICENSE ├── README.md ├── app.js ├── app.json ├── app.wxss ├── images ├── cross.png ├── demo.png └── star.png ├── pages ├── about │ ├── about.js │ └── about.wxml ├── code │ ├── code.js │ └── code.wxml └── index │ ├── index.js │ └── index.wxml └── src ├── wetoast.js ├── wetoast.wxml └── wetoast.wxss /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 kiinlam 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## 公告 2 | 3 | 微信小程序现已在框架升级了`showToast`API,增加了更多自定义功能,推荐使用。本仓库停止更新。需要交流可提Issue,不便之处请海涵。 4 | 5 | `wx.showToast` API地址:https://developers.weixin.qq.com/miniprogram/dev/api/wx.showToast.html 6 | 7 | === 8 | 9 | WeToast for 微信小程序 toast增强插件 10 | === 11 | 12 | ## 概述 13 | 14 | [WeToast](https://github.com/kiinlam/wetoast) 是仿照微信小程序提供的 `showToast` 功能,提供视觉一致的增强插件,弥补小程序`showToast`功能上的不足(如只能显示`success`、`loading`两种icon,且icon不可去除,持续时间最大10秒等)。 15 | 16 | ## 预览 17 | 18 | [下载WeToast项目](https://github.com/kiinlam/wetoast/archive/master.zip),用[微信web开发者工具](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html)打开项目根目录 19 | 20 | demo capture 21 | 22 | ## 如何使用 23 | 24 | WeTaost插件源码位于`src`目录下,包含3个文件。 25 | 26 | - wetoast.js: 脚本代码 27 | - wetoast.wxml: 模板结构 28 | - wetoast.wxss: 样式 29 | 30 | 使用时只需要加入以上3个文件即可,使用方法可参考本项目示范。 31 | 32 | #### 推荐方案 33 | 34 | ##### Step1、在项目的`app.js`中引入`wetoast.js`,并注册到小程序上,小程序所有Page页面均可使用,无需再次引入 35 | 36 | ```javascript 37 | let {WeToast} = require('src/wetoast.js') // 返回构造函数,变量名可自定义 38 | App({ 39 | WeToast // 后面可以通过app.WeToast访问 40 | }) 41 | ``` 42 | 43 | ##### Step2、在项目的`app.wxss`中引入`wetoast.wxss` 44 | 45 | ```css 46 | @import "src/wetoast.wxss"; 47 | ``` 48 | 49 | ##### Step3、引入WeToast模板结构, 50 | 51 | *方式一,在单独页面使用* 52 | 53 | ```html 54 | 55 | 56 |