Network APIs

share

Share the current Miniapp using Super Qi.

Overview

AlipayJSBridge.call("qicardShareAppMessage", ...) shares a Miniapp message. You configure the share content (title/description/path/image) and receive the share result in the success callback.

Supported types of mini programs: H5+

Sample Code

AlipayJSBridge.call("qicardShareAppMessage", {
  title: "Demo Share Title",
  desc: "Shared from Super Qi miniapp. Tap to open!",
  path: "share.html",
  success: (res) => {
    console.log("[from mini app], share call succeeded: ", JSON.stringify(res));
    my.alert({ content: "success" + JSON.stringify(res) });
  },
  fail: (res) => {
    console.log("[from mini app], share call fail: ", JSON.stringify(res));
    my.alert({ content: "fail" + JSON.stringify(res) });
  },
});

Parameters

PropertyTypeRequiredDescription
titleStringYesshare title
descStringNoshare desc
pathStringNoshare path
imageUrlStringNoshare imageUrl

Success Callback Function

The incoming parameter is an Object with the following attributes:

PropertyTypeDescription
shareResultBooleanThe result that indicates whether if the sharing is successful.

Failure Callback Function

The incoming parameter is an Object that contains error information (the exact fields may vary by runtime/version).

Usage Notes

  • title is required; provide enough context so users know what they will open after sharing.
  • path and imageUrl are optional, but recommended to improve click-through.
  • Use this API only in the H5+ runtime where AlipayJSBridge is available.