# wx.onShareAppMessage(function callback)

Listens on the event triggered when the user taps the Forward button in the upper right menu.

# Parameters

# function callback

The callback function for the event triggered when the user taps the Forward button in the upper right menu.

# Parameters

# Object res
Property Type Description Minimum Version
title string Forwarding title. If it is not specified, the alias in the current Mini Game is used.
imageUrl string Forwarded a link with an image. It can be a path to a web image, a path to a local image file, or a path to an image file in a relative code package directory. Images are displayed at an aspect ratio of 5:4.
query string Query string, in key1=val1&key2=val2 format. When entering a Mini Game from this forwarded message, you can get the query in the startup parameters via wx.getLaunchOptionsSync() or wx.onShow().
imageUrlId string ID of an approved image. For details, see Using Approved Forwarding Images 2.4.3

# Sample Code


  wx.onShareAppMessage(() => {
    return {
      title: 'Forwarding title',
      imageUrl: '' // Image URL
    }
  })

点击咨询小助手