收藏
回答

wx.updateAppMessageShareData已成功 为什么分享出去是个链接?

分享出去后link生效了,但是其他几个字段(title,desc,imgUrl)没生效,分享出去的依旧是个链接

wx.config({

// 开启调试模式时,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。

debug: true,

// 后台返回之前获取的appId

appId: this.AppID,

// 必填,生成签名的时间戳

timestamp: res.data.timestamp,

// 必填,生成签名的随机串

nonceStr: res.data.nonceStr,

// 必填,签名,见附录1

signature: res.data.signature,

jsApiTicket: res.data.jsapi_ticket,

// 必填,需要使用的JS接口列表,所有JS接口列表见附录3

jsApiList: [

'updateAppMessageShareData', // 1.4 分享到朋友

'updateTimelineShareData', // 1.4分享到朋友圈

'getLocalImgData',

'openLocation',

'getLocation'

]


})

setTimeout(() => {

wx.ready(function() {

console.log('微信jsdk加载完毕', wx)

wx.updateAppMessageShareData({

// 分享标题

title: '动禅瑜伽限时抢购活动',

// 分享描述

desc: '动禅瑜伽限时抢购活动,赶紧抢购吧',

// 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致

link: 'http://mall.dongchanyoga.com?sharer=' + id,

// 分享图标

imgUrl: 'http://mall.dongchanyoga.com/file/title.png',

trigger: function(res) {

alert('用户点击分享', res)

},

success: function() {

alert('updateAppMessageShareData success')

},

cancel: function() {

alert('cancel')

},

fail: function(res) {

alert('取消了分享' + JSON.stringify(res))

console.log(res)

}

})

wx.updateTimelineShareData({

// 分享标题

title: '动禅瑜伽限时抢购活动',

// 分享描述

desc: '动禅瑜伽限时抢购活动,点击链接立马抢购吧',

// 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致

link: 'http://mall.dongchanyoga.com?sharer=' + id,

// 分享图标

imgUrl: 'http://mall.dongchanyoga.com/file/title.png',

trigger: function(res) {

alert('用户点击分享', res)

},

success: function() {

alert('updateAppMessageShareData success')

},

cancel: function() {

alert('cancel')

},

fail: function(res) {

alert('取消了分享' + JSON.stringify(res))

console.log(res)

}

})

setTimeout(() => {

wx.hideMenuItems({

menuList: [

'menuItem:share:qq',

'menuItem:share:QZone',

'menuItem:share:weiboApp',

'menuItem:share:facebook',

'menuItem:openWithSafari'

]

})

}, 200)

// 批量隐藏功能按钮接口

})

wx.error(function(res) {

alert(res.errMsg)

console.log('微信加载失败', res)

})

}, 500)


回答关注问题邀请回答
收藏

3 个回答

登录 后发表内容