vue 微信公众号H5分享Hash模式下ios分享路径是正常的,但到了安卓就只能分享首页。差了一下是路径问题,在微信浏览器中Hash模式下,路径是有#的,而微信浏览器会查找#然后添加参数,例如:https://migxin.mypro.com/?from=timeline#/product_details
这种情况,就不能跳转到指定页面,想了很多办法截取重组路径都失败了,最终只能做了个html的中转页进行页面跳转解决这个Hash模式的尴尬。
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script>
function jump () {
var arr = window.location.search.split('?')[1].split('&');
var name = arr[0].split('=')[1];
var id = arr[1].split('=')[1];
var img = arr[2].split('=')[1];
img = 'https://cas.topvj.net/'+img;
var _img = document.getElementById('img');
_img.setAttribute('src',img);
var url = 'https://cas.topvj.net/cas_h5/#/'+name+'/'+id;
var a = document.getElementById('jump');
a.setAttribute('href',url);
var num = 5;
var timer = setInterval(function(){
num --;
var time = document.getE