收集的一些小方法 前端开膛手 2018-08-30 164 阅读1分钟 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; }