search
HomeWeChat AppletMini Program DevelopmentDetailed 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组件详细介绍

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:

微信小程序 toast组件详细介绍

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.