1 找到解决办法的地方
https://segmentfault.com/q/1010000012624104
2 H5页面屏闭音频的原因
https://www.h5anli.com/articles/201701/bgmusicarticle.html
以上是解决参考
1、创建一个vue项目,使用weixin-js-sdk插件,在当前vue页面
import Vue from "vue"; import wx from "weixin-js-sdk"; Vue.use(wx);
this.$get("服务地址xxxxxxxx",data,res => {wx.config({appId: res.appId,timestamp: res.timestamp,nonceStr: res.nonceStr,signature: res.signature,jsApiList: ["onMenuShareTimeline", //分享给好友"onMenuShareAppMessage", //分享到朋友圈"onMenuShareQQ", //分享到QQ"onMenuShareWeibo" //分享到微博]});wx.ready(function(e) {重点在这里document.getElementById('audio').play();var shareData = {title: "分享显示title,desc: "分享显示介绍",link: data.url,imgUrl:"" //分享时候的图片};wx.onMenuShareAppMessage(shareData);wx.onMenuShareTimeline(shareData);wx.onMenuShareQQ(shareData);wx.onMenuShareWeibo(shareData);});},error => {console.log(error);});