tencent cloud

All product documents
Tencent Cloud Super App as a Service
Last updated: 2025-02-25 14:20:12
Share
Last updated: 2025-02-25 14:20:12

hideShareMenu

This API is called using wx.hideShareMenu (Object object).
Feature description:Hides the “Send to Chat” button when the top-right menu is tapped.
Parameter and description: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).
Example:
wx.hideShareMenu({
hideShareItems: ['wechatFriends', 'wechatMoment']
})

showShareMenu

This API is called using wx.showShareMenu (Object object).
Feature description:Displays the "Share", "Send to Chat", and "Share on Moments" buttons in the top-right menu.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
showShareItems
Array.<string>
['wechatFriends', 'wechatMoment']
False
Please check below object.showShareItems Parameter and 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).

object.showShareItems parameters

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".
Example:
wx.showShareMenu({
showShareItems: ['wechatFriends', 'wechatMoment']
})

updateShareMenu

This API is called using wx.updateShareMenu (Object object).
Feature description:Updates the sharing property.
Parameter and description: 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).
Example:
wx.updateShareMenu({
withShareTicket: true
})

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 send, save, or download an 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.
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).
Example:
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 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. This API is in beta and currently only supported on the Android platform.
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&amp;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&amp;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

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