Home  >  Article  >  WeChat Applet  >  Detailed explanation of WeChat applet loading component example

Detailed explanation of WeChat applet loading component example

高洛峰
高洛峰Original
2017-02-17 10:33:102179browse

This article mainly introduces the relevant information about the detailed examples of the loading component of the WeChat applet. Friends who need it can refer to

微信小程序 loading 组件实例详解

loading is usually used when requesting network data. One way to set the display or not through the hidden attribute

Main attributes:

微信小程序 loading 组件实例详解

##wxml

<!---->
<button type="primary" bindtap="listenerButton">显示loading</button>
<!--默认隐藏-->
<loading hidden="{{hiddenLoading}}">正在加载</loading>

js

Page({
 data:{
 // text:"这是一个页面"
 hiddenLoading: true
 },

 /**
 * 监听button点击事件
 */
 listenerButton:function(){
 this.setData({
  hiddenLoading: !this.data.hiddenLoading
 })
 },
 onLoad:function(options){
 // 页面初始化 options为页面跳转所带来的参数
 },
 onReady:function(){
 // 页面渲染完成
 },
 onShow:function(){
 // 页面显示
 },
 onHide:function(){
 // 页面隐藏
 },
 onUnload:function(){
 // 页面关闭
 }
})

Please pay attention to related articles for more detailed examples of WeChat applet loading components PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn