# wx.miniapp.shareTextMessage
Share text to 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 |
---|---|---|---|---|
text | string | - | yes | Shared text |
scene | number | - | yes | 0 = Share to Session, 1 = Share to WeChat Moments, 2 = Share to Favorites |
# JSAPI Examples of code
wx.miniapp.shareTextMessage({
text: Sharing steadily,
scene: 0, // Share to Session
success(res) {
wx.showToast({
title: "Success: Sharing Words,"
})
},
fail() {
wx.showToast({
title: "Failure: Sharing Words,"
})
}
})