当前位置:网站首页>Entering the applet for the first time
Entering the applet for the first time
2022-07-30 19:02:00 【open the door of the world】
The first time to enter the applet judgment
背景需求
- Entering the applet for the first time,show bubbles.
- It disappeared after five seconds,After click event,The display of bubbles disappears
- 如果五秒内,点击了事件,The bubbles disappear
实现
- Enter the bubble for the first time,Show in five seconds,
- 设置一个变量,Controls the appearance of bubbles
- This time a variable is stored,Determine whether it is the first time to show
- 第一次进入,Locally stored variables,肯定是false,If the local variable isfalse ,Then change the bubble variable,为true
- And add a timer,五秒后,Change the local variable to true,and change the value of the bubble to false
- 如果是点击
- 先清空定时器,然后取反即可,and set the local variablefalse
- 注意点
This five-second timing,Is the request finished interface,有数据的时候,Only show bubbles.All this methods are placed after the interface
代码
- Judgment of first entry
bubbleFunc() {
// 气泡
let bubble = wx.getStorageSync('bubble');
if (!bubble) {
this.setData({
isShowBubble: true,
});
}
if (this.data.isShowBubble && this.data.numLikes) {
this.$data.timerID = setTimeout(() => {
this.setData({
isShowBubble: false,
});
clearInterval(this.$data.timerID);
}, 5000);
wx.setStorageSync('bubble', true);
}
},
- 点击逻辑
bubbleHandler() {
clearInterval(this.$data.timerID);
const {
isShowBubble } = this.data;
this.setData({
isShowBubble: !isShowBubble,
});
wx.setStorageSync('bubble', true);
},
边栏推荐
- ctf.show_web5
- MySQL data types
- SwiftUI iOS Boutique Open Source Project Complete Baked Food Recipe App based on SQLite (tutorial including source code)
- The advanced version of the Niu Ke brushing series (team competition, sorting subsequences, inverting strings, deleting common characters, repairing pastures)
- 【Swords Offer】Swords Offer 17. Print n digits from 1 to the largest
- 【PHPWord】Quick Start of PHPWord in PHPOffice Suite
- After 23 years of operation, the former "China's largest e-commerce website" has turned yellow...
- Chapter 14 Type Information
- Swiper rotates pictures and plays background music
- DM8:单库单实例搭建本地数据守护服务
猜你喜欢

Scrapy framework is introduced

node封装一个控制台进度条插件

云数据库和本地数据库有什么区别?

Hello, my new name is "Bronze Lock/Tongsuo"

NC | Tao Liang Group of West Lake University - TMPRSS2 "assists" virus infection and mediates the host invasion of Clostridium sothrix hemorrhagic toxin...

Critical Reviews | A review of the global distribution of antibiotics and resistance genes in farmland soil by Nannong Zou Jianwen's group

AI基础:图解Transformer

"Ruffian Heng Embedded Bimonthly" Issue 59

SwiftUI iOS 精品开源项目之 完整烘焙食品菜谱App基于SQLite(教程含源码)

攻防世界web-Cat
随机推荐
Anaconda Navigator卡在loading applications
Listen to the boot broadcast
开心的聚餐
云数据库和本地数据库有什么区别?
Pytorch基础--tensorboard使用(一)
[Summary] 1396- 60+ VSCode plugins to create a useful editor
requet.getHeader(“token“) 为null
Hello, my new name is "Bronze Lock/Tongsuo"
Graphic LeetCode -- 11. Containers of most water (difficulty: medium)
跨域问题的解决方法
【Pointing to Offer】Pointing to Offer 18. Delete the node of the linked list
自然语言处理nltk
SwiftUI iOS Boutique Open Source Project Complete Baked Food Recipe App based on SQLite (tutorial including source code)
What kind of framework is friendly to developers?
生物医学论文有何价值 论文中译英怎样翻译效果好
又一家公司面试的内容
LeetCode每日一题(1717. Maximum Score From Removing Substrings)
WeChat Mini Program Cloud Development | Urban Information Management
Mysql执行原理剖析
【总结】1396- 60+个 VSCode 插件,打造好用的编辑器