Wx. showToast (OBJECT) is an API provided to display a message prompt box. The following is an official document description: wx. showToast (OBJECT) is an API provided to display a message prompt box.
The following is an official document description:
Although there are only two icons, this "success" icon can be used in many scenarios, however, if you need to wait for the user, you need to use the "loading" icon.
The following is the official sample code:
Wx. showToast ({title: 'success', icon: 'success', duration: 2000 })
The following shows how to use this API. first, open the WEB developer tool, create a quick project, delete unused content on the home page, and retain it, as shown in.
Add the navigator navigation to the default log page.
The WXML code of the index page is as follows:
Login
View more
The js code of the index page is as follows:
Logbtn: function () {wx. showToast ({title: 'login successfully', icon: 'Success ', duration: 1200})}, morebtn: function () {wx. showToast ({title: 'loading ', icon: 'Loading', duration: 1200 })},
The two buttons are too close. we insert a View tag in the middle to make the buttons have more spacing, as shown in the following code:
The page rendering style is as follows:
Through the above demonstration, you can know the effect of this API and the applicable scenarios, and make it easier for you to directly call the official API when needed.
For more information about how to interpret the wx. showToast (OBJECT) of small programs and related articles on use examples, see PHP Chinese network!