微信小程序 - toptip效果
在Page顶部下滑一个提示条 , 代码见 /mixins/UIComponent.js ,其中的self 可以认为是微信小程序的Page对象
效果: 默认2秒展示,上移动画隐藏
/**
* 展示顶部 tip , 多次快速调用,会覆盖前次展示
*/
UIComponent.showToptip = function (opt = {}) {
var self = this;
if (self.uiComponent_topTip_timer) { //如果之前有timer,那么取消后重新创建
clearTimeout(self.uiComponent_topTip_timer);
}
if (typeof opt == "string") {
opt = {
content: opt
}
}
//默认参数,也是外部参考的传参
var defaultOptions = {
show: false, //是否显示,默认不显示
style: "", //外部传入的自定义样式,比如字体,背景色
content: "操作成功", //默认的内容
duration: 2000 //显示延迟几秒
};
let app = getApp();
opt = app.util.extend(defaultOptions, opt);
self.setData({
'uiComponent.toptip.show': true,
'uiComponent.toptip.style': opt.style,
"uiComponent.toptip.content": opt.content
});
self.uiComponent_topTip_timer = setTimeout(() => {
self.setData({
'uiComponent.toptip.show': false
});
}, opt.duration);
}
<view class="uiComponent uiComponent_toptip uiComponent_toptip_{{uiComponent.toptip.show &&'active'}}"
style="{{uiComponent.toptip.style}}" >{{uiComponent.toptip.content}} </view>
.uiComponent {
z-index:;
}
/* toptip 顶部提示条效果 */
.uiComponent_toptip {
width: 100%;
display: block;
top:-50px;
position: fixed; text-align: center;
line-height: 2.3;
font-size: 30rpx;
transition: all .2s linear ;
} .uiComponent_toptip_active {
top:;
transition: all .3s linear ;
min-height: 32px;
color: #fff;
background-color: rgba(0,0,0,.8);
}
微信小程序 - toptip效果的更多相关文章
- 微信小程序 折叠效果
<view class='help'> <view class='help_item'> <view class='title' data-index='1' catch ...
- 微信小程序 --- 日历效果
wxml部分: <view class='box1' style='width: {{ sysW * 7 }}px'> <view class='dateBox'>{{ yea ...
- 微信小程序学习指南
作者:初雪链接:https://www.zhihu.com/question/50907897/answer/128494332来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明 ...
- weapp微信小程序初探demo
https://github.com/donglegend/weapp-demo 参考文档开发工具安装微信weapp API git项目源码微信小程序 demo效果展示效果预览
- 近期热门微信小程序demo源码下载汇总
近期微信小程序demo源码下载汇总,乃小程序学习分析必备素材!点击标题即可下载: 即速应用首发!原创!电商商场Demo 优质微信小程序推荐 -秀人美女图 图片下载.滑动翻页 微信小程序 - 新词 GE ...
- 微信小程序初见+nodejs服务端 (一个简单的博客)
推荐网址: 腾讯云快速开发(nodejs前后端):https://developers.weixin.qq.com/miniprogram/dev/qcloud/qcloud.html#%E5%AF% ...
- 微信小程序开发学习资料
作者:初雪链接:https://www.zhihu.com/question/50907897/answer/128494332来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明 ...
- 微信小程序资源整理
微信小程序相关的文档.教程.开源项目等资源的整理,以便于开发学习使用. —— —— 收录仅作个人学习使用,涉及侵权行为及时联系: maple_6392@163.com 项目地址:GitHub | 码云 ...
- 微信小程序学习 动手撸一个校园网小程序
动手撸一个校园网微信小程序 高考完毕,想必广大学子和家长们都在忙着查询各所高校的信息,刚好上手微信小程序,当练手也当为自己的学校做点宣传,便当即撸了一个校园网微信小程序. 效果预览 源码地址:Gith ...
随机推荐
- Linux下双物理网卡设置成虚拟网卡
为了提供网络的高可用我们须要将多块网卡绑定设置成一块虚拟的网卡对外提供服务,这样能够防止一块网卡损坏或者防止网线连接故障造成的连接中断. 以下我们使用eth0与eth1来虚拟成为bond0为例:--- ...
- 《Go并发编程实战》第2版 紧跟Go的1.8版本号
文章作者:郝林(<Go并发编程实战 (第2版)>作者) 最终来了! 经过出版社的各位编辑.校对.排版伙伴与我的N轮PK和共同努力,<Go并发编程实战>第2版的全部内容最终全然确 ...
- daemon与服务(service)及重启服务的方法
简单地说,系统为了某些功能必须要提供一些服务(不论是系统本身还是网络方面),这个服务就称为service.而实现这个service的程序我们就称它为daemon.实现某个服务是需要一个daemon在后 ...
- java.sql.SQLException: Data truncation: Truncated incorrect DOUBLE value
mysql 报这个异常:java.sql.SQLException: Data truncation: Truncated incorrect DOUBLE value update 表名 set c ...
- xftp Initialize Flexnet Service failed / Error code: 50003
xftp Initialize Flexnet Service failed / Error code: 50003 CreateTime--2018年5月3日15:47:05 Author:Ma ...
- oracle查询表数据并重新插入到本表
oracle查询表数据并重新插入到本表 CreateTime--2018年5月17日10:30:10 Author:Marydon 1.情景描述 --查询表中数据 SELECT * FROM at ...
- powershell执行脚本
powershell执行脚本 执行powershell脚本有两种方式: 1.通过命令行参数启动脚本 C:\Windows\System32\WindowsPowerShell\v1.0\power ...
- 基于微信小程序的用户列表点赞功能
代码地址如下:http://www.demodashi.com/demo/13997.html 一.前言 (1).适合人群 1.微信小程序开发者 2.前端工程师 3.想入门学习小程序开发的人员 4.想 ...
- IDEA使用及优化
1.修改IntelliJ IDEA\bin\idea64.exe.vmoptions文件的内容 2.Setting配置 2.1 设置主题 2.2 设置编辑区主题 如果想要更多的主题效果的话,可以到如下 ...
- webqq协议分析之~~~~验证是否需要验证码
对于小黄鸡我想大家(喜欢在群里bb的人...)肯定一点都不陌生,那段时间大家在群里对小鸡是各种调戏啊,都有点不忍直视.那时我便想能不能自己也做个呢,后来想想还是算了吧,自己技术太渣渣,然后就不了了之. ...