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;
}
复制代码
转载于:https://juejin.im/post/5b87e2a551882542fd2391a4
上一篇: 自定义文件选择器
下一篇: 最近用的的一些小方法