This API is called using wx.hideShareMenu (Object object).
Property | Type | Default value | Required | Description |
hideShareItems | Array.<string> | - | False | For the list of names of the "Share" buttons that need to be hidden, please check below object.hideShareItems parameter and description, and after the superapp has customized the sharing capability, the value shall be subject to shareKey. |
success | function | - | False | Callback function for successful API calls. |
fail | function | - | False | Callback function for failed API calls. |
complete | function | - | False | Callback function executed after API call ends (regardless of success or failure). |
Value | Description |
'wechatFriends' | WeChat Contacts |
'wechatMoment' | WeChat Moments |
'qq' | QQ Contacts |
'qzone' | QQ Zone |
wx.hideShareMenu({hideShareItems: ['wechatFriends', 'wechatMoment']})
This API is called using wx.showShareMenu (Object object).
Property | Type | Default value | Required | Description |
showShareItems | Array.<string> | - | False | For the list of names of the "Share" buttons that need to be displayed, please check below object.showShareItems parameter and description, and after the superapp has customized the sharing capability, the value shall be subject to shareKey. |
success | function | - | False | Callback function for successful API calls. |
fail | function | - | False | Callback function for failed API calls. |
complete | function | - | False | Callback function executed after API call ends (regardless of success or failure). |
Value | Description |
'wechatFriends' | WeChat Contacts |
'wechatMoment' | WeChat Moments |
'qq' | QQ Contacts |
'qzone' | QQ Zone |
wx.showShareMenu({showShareItems: ['wechatFriends', 'wechatMoment']})
This API is called using wx.showShareImageMenu (Object object).
Property | Type | Default value | Required | Description |
path | string | - | True | The local or temporary path of the image to share. |
success | function | - | False | Callback function for successful API calls. |
fail | function | - | False | Callback function for failed API calls. |
complete | function | - | False | Callback function executed after API call ends (regardless of success or failure). |
wx.downloadFile({url: 'https://res.wx.qq.com/wxdoc/dist/assets/img/demo.ef5c5bef.jpg',success: (res) => {wx.showShareImageMenu({path: res.tempFilePath})}})
This API is called using wx.onShareAppMessage(function listener)
Property | Type | Description |
title | string | Share title. If not passed, the nickname of the current mini-game will be used by default. |
imageUrl | string | The link of the image displayed for sharing can be a network image path, a local image file path, or an image file path relative to the root directory of the code package. |
query | string | The query string must be in the format of key1=val1&key2=val2. After entering from this shared message, you can obtain the query in the launch parameters through wx.getLaunchOptionsSync() or wx.onShow(). |
path | string |
wx.onShareAppMessage(() => {return {title: 'Share Title',imageUrl: '' // Image URLquery: 'name=1&phone=2'}})
This API is called using wx.onCopyUrl(function listener).
Property | Type | Description |
query | string | The query string carried by the current page when opened with a short link. When using this in a mini program, you should call wx.onCopyUrl to customize the query when entering the page and call wx.offCopyUrl when exiting the page to prevent affecting other pages. |
// Bind the shared parameterswx.onCopyUrl(() => {return { query: 'a=1&b=2' }})// Unbind the shared parameterswx.offCopyUrl()
This API is called using wx.offCopyUrl().
// Bind the shared parameterswx.onCopyUrl(() => {return { query: 'a=1&b=2' }})// Unbind the shared parameterswx.offCopyUrl()
Feedback