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。
| Properties | Type | Default value | Required | Description |
|---|---|---|---|---|
| hideShareItems | Array.<string> | 'luffaChatFriends' | No | luffaChatFriends: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 |
| success | Function | - | No | Callback function for successful interface call |
| fail | Function | - | No | Callback function for failed interface call |
| complete | Function | - | No | Callback 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。
| Properties | Type | Default value | Required | Description |
|---|---|---|---|---|
| showShareItems | Array.<string> | 'LuffachatFriends' | No | Please see below object.showShareItemsParameter Description |
| withShareTicket | boolean | false | No | Whether to use forwarding with shareTicket, supported from Android basic library version 1.4.0, iOS basic library version 1.4.3 |
| success | Function | - | No | Callback function for successful interface call |
| fail | Function | - | No | Callback function for failed interface call |
| complete | Function | - | No | Callback function for interface call completion (executed regardless of success or failure) |
object.showShareItems parameter
Value Description '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。
| Properties | Type | Default value | Required | Description |
|---|---|---|---|---|
| withShareTicket | boolean | false | No | Whether to use forwarding with shareTicket |
| success | Function | - | No | Callback function for successful interface call |
| fail | Function | - | No | Callback function for failed interface call |
| complete | Function | - | No | Callback 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。
| Properties | Type | Default value | Required | Description |
|---|---|---|---|---|
| path | string | - | Yes | The picture address to be shared must be a local path or a temporary path |
| style | string | default | No | Sharing style |
| needShowEntrance | string | false | No | Whether the shared picture message should have a mini program entrance (only available for some mini program categories) |
| entrance | string | false | No | The 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 |
| success | Function | - | No | Callback function for successful interface call |
| fail | Function | - | No | Callback function for failed interface call |
| complete | Function | - | No | Callback 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,
| Properties | Type | Description |
|---|---|---|
| query | string | The 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()