# wx.miniapp.shareImageMessage
Share pictures on WeChat
Note:
1, the interface needs to apply and initialize WeChat open Capabilities, requires the client to configure the relevant
2, the interface does not support theMobile App AssistantDebugging, developers need to build Apk or ipa Install to the phone before debugging
# Precautions before Access
- This ability dependsWeChat Open SDK , need to follow the guidelines in theWeChat Open PlatformCreate a mobile application account to complete the relevant initialization configuration, details can be viewedWeChat mobile application capability initialization guidelines
# parameter
Easy for developers to understand, wx.miniapageshareImageMessage Parameters andWeChat Open Platform opensdk Sharing interfaceConsistent parameters
attribute | type | Default value | Required | Introductions |
---|---|---|---|---|
imagePath | string | - | yes | Share images, support code package image resource path or local temporary, cache, user fileGraph of a network is not supported |
thumbPath | string | - | yes | Share thumbnails, support code package image resource path or local temporary, cache, user fileGraph of a network is not supported |
scene | number | - | yes | 0 = Share to Session, 1 = Share to WeChat Moments, 2 = Share to Favorites |
entranceMiniProgramUsername | string | - | no | Start the Mini Program username (original id of the Mini Program, gh_xxx)iOS SDK >=1.3.36Android SDK >=1.3.26 |
entranceMiniProgramPath | string | - | no | Start small pathiOS SDK >=1.3.36Android SDK >=1.3.26 |
Remarks:
- EntranceMiniProgramUsername: Indicates whether the shared picture message should be entered with a Mini Program. If it is not empty, it is displayed
- EntranceMiniProgramPath: Shared Picture Message Mini Program The Mini Program path that the entry can jump to
# Call Example
wx.miniapp.shareImageMessage({
imagePath: '/pages/share.png',
thumbPath: '/pages/thumb.png',
scene: 0,
success(res) {
wx.showToast({
title: "Success: Sharing Pictures"
})
},
fail() {
wx.showToast({
title: "Failure: Sharing Pictures"
})
}
})