Component({
externalClasses: ['i-class'],
options: {
multipleSlots: true
},
properties: {
//info, success, warning, error
type: {
type: String,
value: 'info'
},
closable: {
type: Boolean,
value: false
},
showIcon: {
type: Boolean,
default: false
},
desc: {
type: Boolean,
default: false
},
top: {
type: Number,
default: 0
}
},
data: {
closed: true,
interval: null, //tips计时器
// duration:5,//计时时间
},
methods: {
handleTap() {
this.setData({
closed: !this.data.closed,
});
this.triggerEvent('close');
},
closeTips:function(){
this.setData({
closed: true,
});
},
showTips(event, title, content) {
this.setData({
top: event.currentTarget.offsetTop,
closed: false,
});
let query = this.createSelectorQuery();
query.select('#mytips').boundingClientRect()
query.exec((res) => {
console.log(res)
// 计算容器高度
let tabTargetPosition = event.detail.y;
let tabTargetPositionLet = event.detail.x;
let containerHeight = res[0].height;
let containerWidth = res[0].width;
let additionalX = 20;
let additionaly = 20;
let showTop = tabTargetPosition - containerHeight - additionalX;
let showLeft = tabTargetPositionLet - containerWidth - additionaly;
console.log(event);
console.log(tabTargetPosition, containerHeight);
this.setData({
top: showTop,
left: showLeft,
});
});
},
closeTips(obj) {
this.setData({
interval: null,
closed: true
});
},
}
});
没有合适的资源?快使用搜索试试~ 我知道了~
微信小程序、提示组件、用于解释提示
共8个文件
json:2个
wxss:2个
js:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 2 下载量 147 浏览量
2022-04-05
16:09:31
上传
评论
收藏 4KB ZIP 举报
温馨提示
实现功能:用于点击文字标题或者"问号"点击后弹出提示组件显示简单的内容提示,方便查看解释
资源推荐
资源详情
资源评论
收起资源包目录
tips.zip (8个子文件)
pages
component
tips.js 1KB
tips.wxml 558B
tips.wxss 31B
tips.json 74B
components
tips
tips.js 2KB
tips.wxml 1KB
tips.wxss 2KB
tips.json 48B
共 8 条
- 1
资源评论
- yingbao6202022-07-05感谢大佬分享的资源给了我灵感,果断支持!感谢分享~
- Errrrrrric2022-10-19资源内容详细全面,与描述一致,对我很有用,有一定的使用价值。
河里抓鲨鱼
- 粉丝: 1
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功