1,獲取url的引數
export const urlParse = (url=location.href) => {
const reg = /[?&]([^#&?]+)=([^#&\?=]+)/g;
let obj = {};
url.replace(reg, (group, catch1, catch2, index, str) => {
obj[catch1] = catch2;
});
return obj;
}
複製程式碼
1,獲取url的引數
export const urlParse = (url=location.href) => {
const reg = /[?&]([^#&?]+)=([^#&\?=]+)/g;
let obj = {};
url.replace(reg, (group, catch1, catch2, index, str) => {
obj[catch1] = catch2;
});
return obj;
}
複製程式碼