This API is called using wx.hideShareMenu (Object object).
Property | Type | Default value | Required | Description |
hideShareItems | Array.<string> | ['wechatFriends', 'wechatMoment'] | False | wechatFriends: Controls whether to hide “Send to Chat” 'wechatMoment: Controls whether to hide the "Share on Moments" option. If the hideShareItems parameter is not provided, the default is to hide all options: "Share" and "Send to Chat". |
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.hideShareMenu({hideShareItems: ['wechatFriends', 'wechatMoment']})
This API is called using wx.showShareMenu (Object object).
Property | Type | Default value | Required | Description |
showShareItems | Array.<string> | ['wechatFriends', 'wechatMoment'] | False | |
withShareTicket | boolean | false | False | Whether to use shareTicket for sharing. |
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' | Controls whether to hide “Send to Chat” |
'wechatMoment' | Controls whether to hide the "Share on Moments" option. If the hideShareItems parameter is not provided, the default is to hide all options: "Share" and "Send to Chat". |
wx.showShareMenu({showShareItems: ['wechatFriends', 'wechatMoment']})
This API is called using wx.updateShareMenu (Object object).
Property | Type | Default value | Required | Description |
withShareTicket | boolean | false | False | Whether to use shareTicket for sharing. |
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.updateShareMenu({withShareTicket: true})
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. |
style | string | default | False | The style of sharing. |
needShowEntrance | string | false | False | Whether the shared image message should include a mini program entrance. (Only some mini program categories are available) |
entrance | string | false | False | The path to open the mini program from the message entrance. If the current page allows sharing with friends, it defaults to the current page path; otherwise, it defaults to the mini program's home page. |
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.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()