当前位置:网站首页>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()
},
边栏推荐
- Pytest learning notes (12) -allure feature · @allure Step () and allure attach
- GDB 在嵌入式中的相关概念
- JUC thread scheduling
- Force buckle 204 Count prime
- Dotconnect for PostgreSQL data provider
- d,ldc構建共享庫
- Cloud native topic sorting (to be updated)
- 音程的知识的总结
- LDC Build Shared Library
- Top ten regular spot trading platforms 2022
猜你喜欢
海量数据冷热分离方案与实践
STM32 - switch of relay control lamp
7-25 read numbers (loop switch)
MySQL - database query - basic query
Vant 实现简单的登录注册模块以及个人用户中心
QTableWidget懒加载剩内存,不卡!
网络安全-漏洞与木马
Top ten regular spot trading platforms 2022
[data mining] task 3: decision tree classification
[data mining] task 6: DBSCAN clustering
随机推荐
MySQL - database query - basic query
Look at how clothing enterprises take advantage of the epidemic
After reading this article, I will teach you to play with the penetration test target vulnhub - drivetingblues-9
數學知識:臺階-Nim遊戲—博弈論
Meituan dynamic thread pool practice ideas, open source
网络安全-密码破解
简易分析fgui依赖关系工具
GDB 在嵌入式中的相关概念
Mathematical knowledge: step Nim game game game theory
Steps to obtain SSL certificate private key private key file
openresty 缓存
电信客户流失预测挑战赛
Wordinsert formula /endnote
Do not log in or log in to solve the problem that the Oracle database account is locked.
Main features of transport layer TCP and TCP connection
[shutter] animation animation (animatedwidget animation use process | create animation controller | create animation | create animatedwidget animation component | animation operation)
Concise analysis of redis source code 11 - Main IO threads and redis 6.0 multi IO threads
数学知识:台阶-Nim游戏—博弈论
[data mining] task 3: decision tree classification
d. LDC build shared library