tencent cloud

$0 14-Day TrialExperience EdgeOne for acceleration and security protection!

Feedback

Tencent Cloud Mini Program Platform

Forwarding

Last updated: 2024-11-21 18:41:53

hideShareMenu

This API is used via wx.hideShareMenu(Object object).
Feature Description: Hides the "Share with Friends" button when the top right corner menu is clicked.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
hideShareItems
Array.<string>
['qq', 'qzone', 'wechatFriends', 'wechatMoment']
No
QQ: Control the visibility of the "Forward" option.
Qzone: Manage the visibility of the "Share to Host Client QQ Space" option.
WeChatFriends: Manage the visibility of the "Share to Host Client We Chat Friends" option.
WeChatMoment: Manage the visibility of the "Share to Host Client We Chat Moments" option. Without the hideShareItems parameter, the "Forward", "Share to Host Client QQ Space", "Share to Host Client We Chat Friends", and "Control Visibility" options are all hidden by default.
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
Sample Code
wx.hideShareMenu({
hideShareItems: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
})

showShareMenu

This API is used via wx.showShareMenu(Object object).
Feature Description: When clicking the top-right corner menu, the "Share with Friends", "Share to Host Client QQ Space", "Share to Host Client We Chat Friends", and "Share to Host Client We Chat Moments" buttons for the current page will be displayed.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
showShareItems
Array.<string>
['qq', 'qzone', 'wechatFriends', 'wechatMoment']
No
See the parameter descriptions in object.showShareItems as follows.
withShareTicket
boolean
false
No
Whether to use forwarding with shareTicket, supported from Base Library version 1.4.0 on Android and from Base Library version 1.4.0 on iOS.
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
object.showShareItems Parameter
Value
Description
'qq'
Control whether to display "Forwarding"
'qzone'
Control whether to display "Share to host client QQ Space"
'wechatFriends'
Control whether to display "Host Client We Chat Friends"
'wechatMoment'
Control whether to hide "Share to Host Client We Chat Moments". Without the hideShareItems parameter, "Forwarding", "Share to Host Client QQ Space", "Share to Host Client We Chat Friends", and "Control whether to hide" are all hidden by default.
Sample Code
wx.showShareMenu({
showShareItems: ['qq', 'qzone', 'wechatFriends', 'wechatMoment']
})

updateShareMenu

This API is used via wx.updateShareMenu(Object object).
Feature Description: Updates forwarding attributes.
Parameter and Description: Object.
Attribute
Type
Default value
Required
Description
withShareTicket
boolean
false
No
Whether to use forwarding with shareTicket
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
Sample Code
wx.updateShareMenu({
withShareTicket: true
})

showShareImageMenu

This API is used via wx.showShareImageMenu(Object object)
Function description: Open the picture sharing pop-up window, and you can send pictures to friends, collect them, or download them.
Parameters and description: Object object.
Attribute
Type
Default value
Required
Description
path
string
-
Yes
The image address to be shared must be a local path or a temporary path
style
string
default
No
Share styles
needShowEntrance
string
false
No
Whether the shared picture message needs to have a mini program entry (only some mini program categories are available)
entrance
string
false
No
Open the path of the mini program from the entrance of the message mini program. If the current page allows sharing with friends, the default is the path of the current page. Otherwise, the default is the home page of the mini program.
success
function
-
No
Callback Function of Successful Interface Call
fail
function
-
No
Callback Function of Failing Interface Call
complete
function
-
No
Callback function executed upon the completion of the interface invocation (both successful and unsuccessful invocations)
Sample Code
wx.downloadFile({
url: 'https://res.wx.qq.com/wxdoc/dist/assets/img/demo.ef5c5bef.jpg',
success: (res) => {
wx.showShareImageMenu({
path: res.tempFilePath
})
}
})

onCopyUrl

This API is used via wx.onCopyUrl(function listener)
Function description:Listen to the event triggered when the user clicks the "Copy Link" button in the menu in the upper right corner. This interface is a Beta version and is currently only supported on the Android platform.
Parameters and description:
function listener,Listener function for events triggered when the user clicks the "Copy Link" button in the menu in the upper right corner。
Object res,
Attribute
Type
Description
query
string
The query string carried by the current page when opening the mini program with a short link. When used in a mini program, wx.onCopyUrl custom query should be called when entering the page, and wx.offCopyUrl should be called when exiting the page to prevent it from affecting other pages.
Sample Code
//Bind shared parameters
wx.onCopyUrl(() => {
return { query: 'a=1&b=2' }
})


// Unbind shared parameters
wx.offCopyUrl()


offCopyUrl

This API is used via wx.offCopyUrl()
Function description:Remove all listening functions for events triggered when the user clicks the "Copy Link" button in the menu in the upper right corner.
Sample Code
//Bind shared parameters
wx.onCopyUrl(() => {
return { query: 'a=1&b=2' }
})


// Unbind shared parameters
wx.offCopyUrl()



Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support
Hong Kong, China
+852 800 906 020 (Toll Free)
United States
+1 844 606 0804 (Toll Free)
United Kingdom
+44 808 196 4551 (Toll Free)
Canada
+1 888 605 7930 (Toll Free)
Australia
+61 1300 986 386 (Toll Free)
EdgeOne hotline
+852 300 80699
More local hotlines coming soon