All Products
Search
Document Center

Message

Last Updated: Feb 04, 2021

This section describes the message.

Property Description Type Default value Mandatory
className Custom class String - false
type The messages can be divided into five types, success, fail, info, warn, waiting, and info. The default type is success String success false
title The title String - true
subTitle Subtitle String - false
mainButton Text and relevant availability of the main button Object<buttonText, disabled> - false
subButton Text and relevant availability of the secondary button Object<buttonText, disabled> - false
onTapMain Click function of the main button () => {} - false
onTapSub Click function of the secondary button () => {} - false

Sample code

 
  1. {
  2. "defaultTitle": "AntUI component library of the Mini Program",
  3. "usingComponents": {
  4. "message": "mini-antui/es/message/index"
  5. }
  6. }
 
  1. <view>
  2. <message
  3. title="{{title}}"
  4. subTitle="{{subTitle}}"
  5. type="success"
  6. mainButton="{{messageButton.mainButton}}"
  7. subButton="{{messageButton.subButton}}"
  8. onTapMain="goBack">
  9. </message>
  10. </view>
 
  1. Page({
  2. data: {
  3. title: "Operation succeeded",
  4. subTitle: "The content details can be folded. No more than two lines is recommended",
  5. messageButton: {
  6. mainButton: {
  7. buttonText: "Main operation"
  8. },
  9. subButton: {
  10. buttonText: "Auxiliary operation"
  11. }
  12. }
  13. },
  14. goBack() {
  15. my.navigateBack();
  16. }
  17. });