当前位置:网站首页>Certaines fonctionnalités du développement d'applets
Certaines fonctionnalités du développement d'applets
2022-07-03 01:44:00 【Blizzard Front End】
Préparation avant le projet
Désactiver l'avertissement automatique de surcharge thermique:Détails->Paramètres locaux->Fermer“Activer la surcharge thermique automatique du Code”
Nouveau projet et structure du projet
Configurer les effets de la barre de navigation
Globalapp.json->window
ConfigurationtabBar
Dans l'ensembleapp.jsonNeutralisationwindowNiveau pour créer untabBarNoeud
Réaliser l'effet de la carte de la roue
Adresse de l'interface
①Interface pour obtenir la liste des données du diagramme de rotation
②Définir dans la Sous - page la méthode d'obtention des données du diagramme de rotation
③InonloadAppelez cette méthode dans-AdoptionthisAppelé dès que la page instance est chargée
④AdoptionsetDate() Assigner des valeurs aux données dataLe tableau à l'intérieur
data: {
// Liste des données de la carte de diffusion
swiperList:[]
},
// Méthode d'obtention des données du diagramme de rotation
getSwiperLsit()
{
wx.request({
url:'https://www.escook.cn/slides',
method:'GET',
success:(res)=>{
console.log(res);
this.setData({
swiperList:res.data
})
}
})
},
⑤ L'effet du rendu d'un diagramme de roue
<swiper indicator-dots circular>
<swiper-item wx:for="{
{swiperList}}" wx:key="id">
<image src="{
{item.image}}">
</image>
</swiper-item>
</swiper>
Fonction pull up touch Bottom
Étape 1- Définir une méthode pour obtenir des couleurs au hasard
data: {
colorList:[]
},
getColors(){
wx.request({
url: 'https://www.escook.cn/api/color',
method:'get',
success:({
data:res})=>{
console.log(res)
// Data Splice
this.setData({
colorList:[...this.data.colorList,...res.data]
})
}
})
},
Étape 2- Obtenir les données initiales lorsque la page est chargée
/** * Fonction du cycle de vie--Chargement de la page d'écoute */
onLoad(options) {
this.getColors()
},
Étape 3-RendreUI Structure et embellissement de la page
<!--pages/contact/contact.wxml-->
<view wx:for="{
{colorList}}" wx:key="index" class="num-item" style="background-color: rgba({
{
item}});">{
{item}}</view>
La page doit être assez grande pour être mise à jour
Étape 4-Obtenez une couleur aléatoire lorsque vous tirez vers le haut et touchez le bas
//Fonction de gestion de l'événement pull Bottom sur la page
onReachBottom:function(){
// Appelez la méthode pour obtenir des couleurs aléatoires
this.getColors()
}
Tirer vers le Haut rafraîchir, Accès unique aux données 10Article (s),Par10La barre devient20Article (s)
Étape 5-AjouterloadingEffet de rappel
getColors(){
//PrésentationloadingEffets
wx.showLoading({
title: 'Chargement des données...',
})
wx.request({
url: 'https://www.escook.cn/api/color',
method:'get',
success:({
data:res})=>{
console.log(res)
// Data Splice
this.setData({
colorList:[...this.data.colorList,...res.data]
})
},
// Désactiver manuellement le chargement des données
complete:()=>{
wx.hideLoading()
}
})
},
Étape 6-Réglage des gaz sur le fond de contact de traction
data: {
colorList:[],
isloading:false
},
getColors(){
this.setData({
isloading:true
})
//PrésentationloadingEffets
wx.showLoading({
title: 'Chargement des données...',
})
wx.request({
url: 'https://www.escook.cn/api/color',
method:'get',
success:({
data:res})=>{
console.log(res)
// Data Splice
this.setData({
colorList:[...this.data.colorList,...res.data]
})
},
// Désactiver manuellement le chargement des données
complete:()=>{
wx.hideLoading()
this.setData({
isloading:false
})
}
})
},
onReachBottom() {
if(this.data.isloading) return
this.getColors()
},
边栏推荐
- [principles of multithreading and high concurrency: 2. Solutions to cache consistency]
- Openresty cache
- VIM 9.0 is officially released! The execution speed of the new script can be increased by up to 100 times
- View of MySQL
- Network security ACL access control list
- 网络安全-防火墙
- Why can't the start method be called repeatedly? But the run method can?
- [shutter] animation animation (animatedbuilder animation use process | create animation controller | create animation | create components for animation | associate animation with components | animatio
- Installation and use of serial port packet capturing / cutting tool
- String splicing function of MySQL
猜你喜欢
How is the mask effect achieved in the LPL ban/pick selection stage?
Qtablewidget lazy load remaining memory, no card!
网络安全-漏洞与木马
CF1617B Madoka and the Elegant Gift、CF1654C Alice and the Cake、 CF1696C Fishingprince Plays With Arr
7-25 read numbers (loop switch)
【數據挖掘】任務6:DBSCAN聚類
High-Resolution Network (篇一):原理刨析
Smart management of Green Cities: Digital twin underground integrated pipe gallery platform
C#应用程序界面开发基础——窗体控制(1)——Form窗体
mysql
随机推荐
Why can't the start method be called repeatedly? But the run method can?
Expérience de recherche d'emploi d'un programmeur difficile
String splicing function of MySQL
STM32 - introduction of external interrupts exti and NVIC
Network security NAT network address translation
Steps to obtain SSL certificate private key private key file
Network security - dynamic routing protocol rip
云原生题目整理(待更新)
英语常用词汇
LeetCode 987. Vertical order transverse of a binary tree - Binary Tree Series Question 7
【数据挖掘】任务5:K-means/DBSCAN聚类:双层正方形
网络安全-中间人攻击
[data mining] task 4:20newsgroups clustering
[shutter] animation animation (the core class of shutter animation | animation | curvedanimation | animationcontroller | tween)
Cloud native topic sorting (to be updated)
网络安全-浅谈安全威胁
Why is it not recommended to use BeanUtils in production?
[Cao gongzatan] after working in goose factory for a year in 2021, some of my insights
How is the mask effect achieved in the LPL ban/pick selection stage?
leetcode刷题_两数之和 II - 输入有序数组