E企盈营销工具技术服务商 热线:4006-838-530

微信小程序在webview页面做分享,并且把分享的参数传递给小程序

E企盈直播平台营销卖货系统

QQ技术交流群 173683866 526474645 欢迎加入交流讨论,打广告的一律飞机票本demo实现的功能,微信小程序给h5传参,h5给小程序传参实现代码:!–index.wxml —  web-view src=”https://xxx.xxx.cn/test1.html?user=12″ bindmessage=”bindGetMsg”/js// index.jsPage({  data: {    shareObj: ”  },  onLoad: function(options) {    console.log(‘options’, options)  },  bindGetMsg: function(e) {    this.data.shareObj = e.detail.data[e.detail.data.length – 1];  },  // 分享  onShareAppMessage(options) {    let shareObj = this.data.shareObj;    if (shareObj) {      return {        title: shareObj.shareTitle,        desc: shareObj.shareDesc,        path: shareObj.url,        imageUrl: shareObj.shareImage,        success: function(res) {          console.log(res)        }      }    }  },})html代码!DOCTYPE htmlhtmlheadmeta charset=”UTF-8″script type=”text/javascript” src=”https://res.wx.qq.com/open/js/jweixin-1.3.2.js”/scriptmeta name=”viewport” content=”width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0″ /title/title/headbodyscript type=”text/javascript”var obj = {‘url’: ‘/pages/index/index?shareUserId=213214′,’shareDesc’: ‘分享的描述’,’shareImage’: ‘https://profile.csdnimg.cn/4/6/5/2_qq_35713752′,’shareTitle’: ‘要分享标题’}wx.miniProgram.postMessage({data: obj})console.log(getUrlkey(window.location.href))// url参数解析function getUrlkey(url) {var params = {};if(url.indexOf(“?”) != -1) {var urls = url.split(“?”);var arr = urls[1].split(“&”);for(var i = 0, l = arr.length; i l; i++) {var a = arr[i].split(“=”);params[a[0]] = a[1];}} else {}return params;}/script/body/html

赞(0) 打赏
未经允许不得转载:E企盈小程序开发-热线:4006-838-530 » 微信小程序在webview页面做分享,并且把分享的参数传递给小程序
分享到: 更多 (0)
E企盈小程序直播营销卖货系统
E企盈直播平台营销卖货系统

评论 抢沙发

E企盈小程序开发

联系我们联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏