Created
June 25, 2021 10:21
-
-
Save weikx/fc48fa05bf662d43c484e8e60c7a5aea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 特殊情况用的特殊处理代码 | |
const url = 'http://m.xianmaiyangsheng.com/invitation?otherId=761173&time&otherCode' | |
String.prototype.replaceAll = function(s1, s2) { | |
return this.replace(new RegExp(s1, 'gm'), s2) | |
} | |
function getUrlPatam(url, name) { | |
// 获取地址栏参数 | |
url = decodeURIComponent(url).split('?')[1].replaceAll('&', '_and_').split('_and_').map(item => item.split('=')) | |
url = url.filter(item => item[0] === name).flat() | |
return url[1] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment