当用户进入页面时,监听页面加载,并显示“加载中”字样提示:
1.在生命周期,监听页面加载onLoad中添加以下代码:
onLoad: function (options) {
wx.showLoading({title: '加载中',})
}2.在页面全部加载完后,关闭加载提示:
onReady: function () {
wx.hideLoading() //showLoading 只能用此语句关闭
},3.拓展:
wx.showToast({
title: '成功', //提示语
icon: 'success', //icon: success/loading/none
duration: 2000 //规定自动关闭的时间
})showToast 可使用语句:wx.hideToast() 进行关闭