Commit 9bf7c85c7c5390fedd0b144643a82e8b68e08ea2
1 parent
69ce5891
处理安卓ext数据
Showing
1 changed file
with
13 additions
and
0 deletions
src/main.js
| ... | ... | @@ -587,6 +587,19 @@ Vue.directive("title", { |
| 587 | 587 | el.remove(); |
| 588 | 588 | } |
| 589 | 589 | }); |
| 590 | +/* | |
| 591 | + *处理更改地址在安卓手机下选择地址后传过去的参数 | |
| 592 | + *不在url返回会存在localStorage的ext内,用该方法进行查询 | |
| 593 | + */ | |
| 594 | +Vue.prototype.getParameterByName = function(name, ext) { | |
| 595 | + if (!ext) ext = "&" + window.localStorage.getItem("ext"); | |
| 596 | + name = name.replace(/[\[\]]/g, "\\$&"); | |
| 597 | + var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), | |
| 598 | + results = regex.exec(ext); | |
| 599 | + if (!results) return null; | |
| 600 | + if (!results[2]) return ""; | |
| 601 | + return decodeURIComponent(results[2].replace(/\+/g, " ")); | |
| 602 | +}; | |
| 590 | 603 | /* 修改页面标题指令 结束 */ |
| 591 | 604 | |
| 592 | 605 | /* 插入iframe,用于刷新标题 开始 */ | ... | ... |