http://localhost:20472//AppWeb/ToPay?ptype=2&orderId=e6c1f659-94cd-4e4d-b7c9-56b3c8a7a8d6
function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); var l = decodeURI(window.location.search); var r = l.substr(1).match(reg); if (r != null) return unescape(r[2]); return null; }
笨办法用在了手机端
mounted() { //http://localhost:8080/#/order/Payresult?orderCode=20200721093517378188743943022 var url = window.location.href ; //获取url中"?"符后的字串 var cs = url.split('?')[1]; //获取?之后的参数字符串 //alert(url+'地址');//orderCode=20200721093517378188743943022 var cc =''; var cs2 = ''; if (cs.length > 0) { cs = cs.replace('orderId=', ''); var cc =cs.split('&')[0];//获取orderid var cs1 = cs.split('&')[1];//ocd=20200818103843816416953617735 var cs2 = cs1.replace('ocd=', '');//20200818103843816416953617735 } this.oid = cc; this.orderCode = cs2; }