当前位置:网站首页>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()
},
边栏推荐
- 【QT】自定义控件的封装
- Give you an array numbers that may have duplicate element values. It was originally an array arranged in ascending order, and it was rotated once according to the above situation. Please return the sm
- STM32 - GPIO input / output mode
- How is the mask effect achieved in the LPL ban/pick selection stage?
- Wireshark data analysis and forensics a.pacapng
- 數學知識:臺階-Nim遊戲—博弈論
- [principles of multithreading and high concurrency: 2. Solutions to cache consistency]
- Type expansion of non ts/js file modules
- Telecom Customer Churn Prediction challenge
- 网络安全-破解系统密码
猜你喜欢

Introduction to flask tutorial

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

High resolution network (Part 1): Principle Analysis

How is the mask effect achieved in the LPL ban/pick selection stage?
![[fh-gfsk] fh-gfsk signal analysis and blind demodulation research](/img/8a/8ca80f51a03341c982d52980c54b01.png)
[fh-gfsk] fh-gfsk signal analysis and blind demodulation research

7-25 read numbers (loop switch)

Three core issues of concurrent programming - "deep understanding of high concurrent programming"
![[principles of multithreading and high concurrency: 2. Solutions to cache consistency]](/img/ce/5c41550ed649ee7cada17b0160f739.jpg)
[principles of multithreading and high concurrency: 2. Solutions to cache consistency]

电信客户流失预测挑战赛

海量数据冷热分离方案与实践
随机推荐
[understanding of opportunity -36]: Guiguzi - flying clamp chapter - prevention against killing and bait
STM32 - vibration sensor control relay on
一比特苦逼程序員的找工作經曆
2022-02-15 reading the meta module inspiration of the influxdb cluster
【数据挖掘】任务1:距离计算
[机缘参悟-36]:鬼谷子-飞箝篇 - 面对捧杀与诱饵的防范之道
网络安全-openvas
LDC Build Shared Library
英语常用词汇
What is tone. Diao's story
Virtual list
VIM 9.0 is officially released! The execution speed of the new script can be increased by up to 100 times
One of the C language practical projects is greedy snake
How is the mask effect achieved in the LPL ban/pick selection stage?
Learn the five skills you need to master in cloud computing application development
mysql
Types of map key and object key
[C language] detailed explanation of pointer and array written test questions
The meaning of wildcard, patsubst and notdir in makefile
[data mining] task 6: DBSCAN clustering