当前位置:网站首页>Some functions of applet development
Some functions of applet development
2022-07-03 01:42:00 【Blizzard front end】
Preparation before project
Turn off automatic thermal overload warning : details -> Local settings -> close “ Enable automatic code hot reloading ”
Create a new project and sort out the project structure
Configure navigation bar effects
overall situation app.json->window
To configure tabBar
In the global app.json neutralization window Create a level by level tabBar node 
To achieve the effect of the rotation map
Address of the interface
① Interface for obtaining the data list of the rotation chart
② Define the method of obtaining the data of the rotation chart in the sub page 
③ stay onload This method is called in - adopt this As soon as the instance page is loaded 
④ adopt setDate() Assign data data The array inside
data: {
// A list for storing the data of the carousel
swiperList:[]
},
// Method for obtaining rotation chart data
getSwiperLsit()
{
wx.request({
url:'https://www.escook.cn/slides',
method:'GET',
success:(res)=>{
console.log(res);
this.setData({
swiperList:res.data
})
}
})
},
⑤ Render the effect of the carousel
<swiper indicator-dots circular>
<swiper-item wx:for="{
{swiperList}}" wx:key="id">
<image src="{
{item.image}}">
</image>
</swiper-item>
</swiper>
Pull up and touch the bottom
Step one - Define the method of random color acquisition
data: {
colorList:[]
},
getColors(){
wx.request({
url: 'https://www.escook.cn/api/color',
method:'get',
success:({
data:res})=>{
console.log(res)
// Data splicing
this.setData({
colorList:[...this.data.colorList,...res.data]
})
}
})
},
Step two - Get the initial data when the page is loaded
/** * Life cycle function -- Monitor page loading */
onLoad(options) {
this.getColors()
},
Step three - Rendering UI Structure and beautify the page effect
<!--pages/contact/contact.wxml-->
<view wx:for="{
{colorList}}" wx:key="index" class="num-item" style="background-color: rgba({
{
item}});">{
{item}}</view>
The page should be large enough to pull down and refresh
Step four - Get random color when pulling up to touch the bottom
// Handling function of page pull bottom event
onReachBottom:function(){
// Call the method to get random colors
this.getColors()
}
Pull up to refresh , One time data acquisition 10 strip , from 10 Article becomes 20 strip 
Step five - add to loading Hint effect

getColors(){
// Exhibition loading effect
wx.showLoading({
title: ' Data loading ...',
})
wx.request({
url: 'https://www.escook.cn/api/color',
method:'get',
success:({
data:res})=>{
console.log(res)
// Data splicing
this.setData({
colorList:[...this.data.colorList,...res.data]
})
},
// Manually turn off data loading
complete:()=>{
wx.hideLoading()
}
})
},
Step six - Throttle the pull-up contact bottom

data: {
colorList:[],
isloading:false
},
getColors(){
this.setData({
isloading:true
})
// Exhibition loading effect
wx.showLoading({
title: ' Data loading ...',
})
wx.request({
url: 'https://www.escook.cn/api/color',
method:'get',
success:({
data:res})=>{
console.log(res)
// Data splicing
this.setData({
colorList:[...this.data.colorList,...res.data]
})
},
// Manually turn off data loading
complete:()=>{
wx.hideLoading()
this.setData({
isloading:false
})
}
})
},
onReachBottom() {
if(this.data.isloading) return
this.getColors()
},
边栏推荐
- NCTF 2018 part Title WP (1)
- 7-25 read numbers (loop switch)
- 网络安全-浅谈安全威胁
- [principles of multithreading and high concurrency: 2. Solutions to cache consistency]
- Leetcode skimming questions_ Sum of two numbers II - enter an ordered array
- String splicing function of MySQL
- The thread reuse problem of PageHelper using ThreadLocal, did you use it correctly?
- 一位苦逼程序员的找工作经历
- CF1617B Madoka and the Elegant Gift、CF1654C Alice and the Cake、 CF1696C Fishingprince Plays With Arr
- PS去除水印详解
猜你喜欢

Take you ten days to easily complete the go micro service series (I)

Androd gradle's substitution of its use module dependency

Using tensorboard to visualize the model, data and training process

【数据挖掘】任务5:K-means/DBSCAN聚类:双层正方形

【数据挖掘】任务2:医学数据库MIMIC-III数据处理

Expérience de recherche d'emploi d'un programmeur difficile
![[shutter] animation animation (basic process of shutter animation | create animation controller | create animation | set value listener | set state listener | use animation values in layout | animatio](/img/70/54eb9359ac91aa43383b240eb036b7.gif)
[shutter] animation animation (basic process of shutter animation | create animation controller | create animation | set value listener | set state listener | use animation values in layout | animatio

Leetcode skimming questions_ Sum of two numbers II - enter an ordered array

Vant implements a simple login registration module and a personal user center

STM32 - GPIO input / output mode
随机推荐
What is tone. Diao's story
[androd] module dependency replacement of gradle's usage skills
网络安全-DNS欺骗与钓鱼网站
Three core issues of concurrent programming - "deep understanding of high concurrent programming"
网络安全-防火墙
Qtablewidget lazy load remaining memory, no card!
[技术发展-23]:DSP在未来融合网络中的应用
[North Asia data recovery] data recovery case of raid crash caused by hard disk disconnection during data synchronization of hot spare disk of RAID5 disk array
[data mining] task 6: DBSCAN clustering
After reading this article, I will teach you to play with the penetration test target vulnhub - drivetingblues-9
C#应用程序界面开发基础——窗体控制(3)——文件类控件
英语常用词汇
Top ten regular spot trading platforms 2022
CF1617B Madoka and the Elegant Gift、CF1654C Alice and the Cake、 CF1696C Fishingprince Plays With Arr
Wireshark data analysis and forensics a.pacapng
Druid database connection pool
Installation and use of serial port packet capturing / cutting tool
给你一个可能存在 重复 元素值的数组 numbers ,它原来是一个升序排列的数组,并按上述情形进行了一次旋转。请返回旋转数组的最小元素。【剑指Offer】
并发编程的三大核心问题 -《深入理解高并发编程》
Force buckle 204 Count prime