//地址栏获取参数 function getQueryString(name) { var search = document.location.hash; var pattern = new RegExp("[?&]" + name + "\=([^&]+)", "g"); var matcher = pattern.exec(search); var items = null; if (null != matcher) { try { items = decodeURIComponent(decodeURIComponent(matcher[1])); } catch (e) { try { items = decodeURIComponent(matcher[1]); } catch (e) { items = matcher[1]; } } } return items; }
传的时候:
$(function() { $(".Jump").click(function(){ window.location.href=‘http://10.133.254.129:9000/#/card-search-result?result=123456‘ }); })
取的时候 let result = getQueryString(‘result‘);