实例方法
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| const getQueryString = name => { var result = window.location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i")); if (result == null || result.length < 1) { return ""; } return result[1]; }
JSON.stringify({ asd: '123', qwe: '789', zxc: '356' }).replace(/:/g, "=").replace(/"/g, "").replace(/,/g, "&").match(/\{([^)]*)\}/)[1]
|
Author:蓝思同学
Permalink:https://www.lancema.com/posts/2019/study/JS获取页面通过URL传的参数.html
Slogan:small is beautiful, small is powerful !