tencent cloud

Last updated: 2025-08-06 18:16:52
Share
Last updated: 2025-08-06 18:16:52

hideShareMenu

This API is called using wx.hideShareMenu (Object object).
Feature description: Hide the specified "Share" button in the upper-right corner more menu.
Parameter and description: 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).
object.hideShareItems parameters
Value
Description
'wechatFriends'
WeChat Contacts
'wechatMoment'
WeChat Moments
'qq'
QQ Contacts
'qzone'
QQ Zone
Example:
wx.hideShareMenu({
hideShareItems: ['wechatFriends', 'wechatMoment']
})

showShareMenu

This API is called using wx.showShareMenu (Object object).
Feature description:Display the specified "Share" button in the upper-right corner more menu.
Parameter and description: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).
object.showShareItems parameters
Value
Description
'wechatFriends'
WeChat Contacts
'wechatMoment'
WeChat Moments
'qq'
QQ Contacts
'qzone'
QQ Zone
Example:
wx.showShareMenu({
showShareItems: ['wechatFriends', 'wechatMoment']
})

showShareImageMenu

This API is called using wx.showShareImageMenu (Object object).
Note:
This API is supported in mini programs but not in mini games.
Feature description: Opens a share image dialog to download the image.
Parameter and description: 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).
Example:
wx.downloadFile({
url: 'https://res.wx.qq.com/wxdoc/dist/assets/img/demo.ef5c5bef.jpg',
success: (res) => {
wx.showShareImageMenu({
path: res.tempFilePath
})
}
})

onShareAppMessage

This API is called using wx.onShareAppMessage(function listener)
Note:
This API is only supported in mini games.
Feature description: Listens for the event triggered when the user taps the "Share" button in the top-right menu.
Parameter and description:
function listener, the function that listens for event triggered when the user taps the "Share" button in the top-right menu.
Object res,
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
Independent subpackage path. For details, see mini game independent subpackages.
Example:
wx.onShareAppMessage(() => {
return {
title: 'Share Title',
imageUrl: '' // Image URL
query: 'name=1&phone=2'
}
})

onCopyUrl

This API is called using wx.onCopyUrl(function listener).
Note:
This API is supported in mini programs but not in mini games.
Feature description:Listens for the event triggered when the user taps the "Copy URL" button in the top-right menu.
Parameter and description:
The function that listens for event triggered when the user taps the "Copy URL" button in the top-right menu.
Object res,
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.
Example:
// Bind the shared parameters
wx.onCopyUrl(() => {
return { query: 'a=1&b=2' }
})

// Unbind the shared parameters
wx.offCopyUrl()


offCopyUrl

This API is called using wx.offCopyUrl().
Note:
This API is supported in mini programs but not in mini games.
Feature description:Removes all listeners for event triggered when the user taps the "Copy URL" button in the top-right menu.
Example:
// Bind the shared parameters
wx.onCopyUrl(() => {
return { query: 'a=1&b=2' }
})

// Unbind the shared parameters
wx.offCopyUrl()





Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback