toast 和android的toast一样,这里默认1500ms自动消失,也可以调用hiden消失
默认的icon是success也就是一个对号,设置为none就只显示文字了。
wx.showToast({
title: ‘login success’,
icon:‘none’
duration:1000
})
loading 显示一个loading,需要手动调用hidden消失
wx.showLoading({
title: ‘加载中’,
})
setTimeout(function(){
wx.hideLoading()
},2000)
modal确认对话款
wx.showModal({
title: ‘title’,
content: ‘content’,
success: res => {
if (res.confirm) {
wx.showToast({
title: ‘click ok’,
})
}else if(res.cancel){
wx.showToast({
title: ‘click cancel’,
})
}
}
})