No pages authorized public official documents
Set call authorized address
Jump directly authorized micro-channel links within a page
window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxbbc27d6e2a2b7be9&redirect_uri="+ urlcode+"&response_type=code&scope=snsapi_userinfo&state=123#wechat_redirect"
- redirect_uri page returns after authorization of settable parameters
- Parameters must be used encodeURI encryption (decodeURI) parameters and links are encrypted
- 例子:let urlcode = encodeURI("http://lm.huhacity.com/callBack.html?item="+encodeURI(JSON.stringify(self.InfoData)))
- self.InfoData to carry their own parameters
No. registered micro letter public sharing of official documents
async asynchronous method calls registered micro letter sharing
async wechatShare(){
let self= this
let useUrl = self.useSharData.shardUseId?encodeURI('http://acity.com/#/couponShare?item='+encodeURI(JSON.stringify(self.useSharData))+'&type=true'):''
// Notes custom share links must encodeURI encryption useUrl to share links
const data = await wechatConfig (); // acquired by the micro-channel interface information such as: // appId micro-channel appId timestamp timestamp
// Register the micro-channel configuration information
wx.config({ debug: false, appId: data.data.appId, timestamp: data.data.timestamp, nonceStr: data.data.nonceStr, signature: data.data.signature, jsApiList: [ "onMenuShareTimeline", "onMenuShareAppMessage" ] });
// READY approach to sharing information and registration success callback function customizable sharing
wx.ready(() => {
// circle of friends
wx.onMenuShareTimeline({
title: 'invitation to receive'
link: useUrl,
imgUrl:`http://${window.location.host}/static/images/huha_logo.png`,
success: (data) => {if (data.errMsg === 'onMenuShareTimeline: ok') {this.toast ( 'sharing success');}}, cancel: () => {this.toast (' share failed ');}});
// micro letter friends
wx.onMenuShareAppMessage({
title: 'invitation to receive', // share title
desc: 'invitation to receive', // share description
link: useUrl, // share a link, the link is the same domain or path must correspond with the current page number of the public safety domain name JS
imgUrl: `http: // $ {window.location.host} / static / images / a_logo.png`, // share icon
type: 'link', // share type, music, video, or link, do not fill default link
dataUrl: '', // if the type is music or video, will have to provide data links, the default is empty
success: (data) => {
if (data.errMsg === 'onMenuShareAppMessage: ok') {this.toast ( 'sharing success');}},
cancel: () => {this.toast ( 'share failed');}});})},
Comments Phone micro letter click Customize certainly share a link error when sharing invalid ios not support the port number can not share the link with the port number
Page needs to be loaded into the environment as well do customers do enter the share register trigger automatic registration page sharing needs to be done to delay calling
setTimeout(function() {
this.wechatShare()
}, 1500)