Skip to content

Forwarding

hideShareMenu

TIP

The API usage is as follows: wx.hideShareMenu(Object object)

  • Functional description: Hide the 'Share to Friends' button when clicking the upper right menu.
  • Parameters and descriptions: Object object。
PropertiesTypeDefault valueRequiredDescription
hideShareItemsArray.<string>'luffaChatFriends'NoluffaChatFriends:Control whether to hide 'Share to host client Luffa friends circle', without the hideShareItems parameter, the default is 'Forward', 'Share to host client Luffa friends', and 'Control whether to hide' are all hidden
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Sample code:
js
wx.hideShareMenu({
    hideShareItems: ['LuffachatFriends']
})

showShareMenu

TIP

The API usage is as follows: wx.showShareMenu(Object object)

  • Functional description: Show, 'Share to host client Luffa friends', and 'Share to host client Luffa friends circle' buttons when clicking the upper right menu.
  • Parameters and descriptions: Object object。
PropertiesTypeDefault valueRequiredDescription
showShareItemsArray.<string>'LuffachatFriends'NoPlease see below object.showShareItemsParameter Description
withShareTicketbooleanfalseNoWhether to use forwarding with shareTicket, supported from Android basic library version 1.4.0, iOS basic library version 1.4.1
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • object.showShareItems parameter

    ValueDescription
    'wechatFriends'Control whether to display 'Host client Luffa friends'
  • Sample code:

js
wx.showShareMenu({
  showShareItems: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
})

updateShareMenu

TIP

The API usage is as follows: wx.updateShareMenu(Object object)

  • Functional description: Update forwarding properties.
  • Parameters and descriptions: Object object。
PropertiesTypeDefault valueRequiredDescription
withShareTicketbooleanfalseNoWhether to use forwarding with shareTicket
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Sample code:
js
wx.updateShareMenu({
  withShareTicket: true
})

showShareImageMenu

TIP

The API usage is as follows: wx.showShareImageMenu(Object object)

  • Functional description: Open the share picture pop-up window, you can send pictures to friends, collect or download them.
  • Parameters and descriptions: Object object。
PropertiesTypeDefault valueRequiredDescription
pathstring-YesThe picture address to be shared must be a local path or a temporary path
stylestringdefaultNoSharing style
needShowEntrancestringfalseNoWhether the shared picture message should have a mini program entrance (only available for some mini program categories)
entrancestringfalseNoThe path to open the mini program from the message mini program entrance. If the current page allows sharing to friends, the default is the current page path, otherwise the default is the mini program homepage
successFunction-NoCallback function for successful interface call
failFunction-NoCallback function for failed interface call
completeFunction-NoCallback function for interface call completion (executed regardless of success or failure)
  • Sample code:
js
 wx.downloadFile({
   url: 'https://res.wx.qq.com/wxdoc/dist/assets/img/demo.ef5c5bef.jpg',
   success: (res) => {
     wx.showShareImageMenu({
       path: res.tempFilePath
     })
   }
 })

onCopyUrl

TIP

The API usage is as follows: wx.onCopyUrl(function listener)

  • Functional description: Listen for the event triggered when the user clicks the "Copy Link" button in the upper right corner menu. This interface is a Beta version and is only supported on the Android platform
  • Parameters and descriptions:
    • function listener, the listener function of the event triggered when the user clicks the "Copy Link" button in the upper right corner menu.
    • Object res,
PropertiesTypeDescription
querystringThe query string carried by the current page when opening the mini program with a short link. When used in the mini program, the wx.onCopyUrl custom query should be called when entering the page, and wx.offCopyUrl should be called when exiting the page to prevent affecting other pages
  • Sample code:
js
  // on
  wx.onCopyUrl(() => {
    return { query: 'a=1&b=2' }
  })

  // off
  wx.offCopyUrl()

offCopyUrl

TIP

The API usage is as follows: wx.offCopyUrl()

  • Functional description: Remove all listener functions for the event triggered when the user clicks the "Copy Link" button in the upper right corner menu.

  • Sample code:

js
  // on
  wx.onCopyUrl(() => {
    return { query: 'a=1&b=2' }
  })

  // off
  wx.offCopyUrl()