直接在代码里控制
文档地址:
https://mp.weixin.qq.com/debug/wxadoc/dev/api/api-react.html?t=20161107#wxshowtoastobjectjs
showLoading:function(){ wx.showToast({ title: '加载中', icon: 'loading' }); }, cancelLoading:function(){ wx.hideToast(); }
在wxml文件里布局弹窗,利用条件渲染,在js代码里控制是否显示
文档地址:
https://mp.weixin.qq.com/debug/wxadoc/dev/framework/view/wxml/list.html?t=20161107wxml
<view > <loading wx:if="{{showLoading}}">加载中</loading> </view>
js
data: { showLoading:true }, showLoading:function(){ this.setData({ showLoading:true }) }, cancelLoading:function(){ this.setData({ showLoading:false })
ITDogFire –弓长剑鸣