js从 URL 获取查询参数
传递 window.location 或原始 URL值 goole.com?search=easy&page=3 从 url 轻松检索查询参数
const getParameters = (URL) => {
URL = JSON.parse('{"' + decodeURI(URL.split("?")[1]).replace(/"/g, '\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');
return JSON.stringify(URL);
};
getParameters(window.location) // Result: { search : "easy", page : 3 }

浙公网安备 33010602011771号