Home >WeChat Applet >Mini Program Development >Detailed introduction to the toast component of WeChat applet
This article mainly introduces the relevant information about the detailed introduction of the toast component of the WeChat applet. Friends who need it can refer to the
toast message prompt box, which can be used to prompt some Information, such as clearing the cache, gives users a friendly reminder! Or operate some requests and do not want the user to perform any operations. Toast can also be used because other operations are invalid when toast is displayed.
Main attributes:
wxml
<!--点击button触发toast--> <button type="primary" bindtap="listenerButton">点击显示toast</button> <!--toast消息框显示3秒,并绑定事件--> <toast hidden="{{hiddenToast}}" duration="3000" bindchange="toastHidden" >OK!</toast>
##js
##Page({ data:{ // text:"这是一个页面" hiddenToast: true }, /** * 监听button点击事件 */ listenerButton: function() { this.setData({ hiddenToast: !this.data.hiddenToast }) }, /** * toast显示时间到时处理业务 */ toastHidden:function(){ this.setData({ hiddenToast: true }) }, onLoad:function(options){ // 页面初始化 options为页面跳转所带来的参数 }, onReady:function(){ // 页面渲染完成 }, onShow:function(){ // 页面显示 }, onHide:function(){ // 页面隐藏 }, onUnload:function(){ // 页面关闭 } })
For more detailed introduction to the toast component of the WeChat applet and related articles, please pay attention to the PHP Chinese website!