# wx.miniapp.shareWebPageMessage
Share web pages 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 |
---|---|---|---|---|
title | string | - | yes | Web Page Title |
description | string | - | yes | Web Description |
thumbPath | string | - | yes | Share thumbnails, support code package image resource path or local temporary, cache, user fileGraph of a network is not supported |
webpageUrl | string | - | yes | share webpage url |
scene | number | - | yes | 0 = Share to Session, 1 = Share to WeChat Moments, 2 = Share to Favorites |
# JSAPI Examples of code
wx.miniapp.shareWebPageMessage({
title: Title of the page,
description: Description of the page,
thumbPath: '/pages/thumb.png',
WebpageUrl: 'www.qq.com',
scene: 0,
success(res) {
wx.showToast({
title: "Success: Sharing Web Pages,"
})
},
fail() {
wx.showToast({
title: "Failure: Sharing Web Pages,"
})
}
})