1 Star 0 Fork 0

飞扬的枫/vue-template-elementui

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
utils.js 501 Bytes
一键复制 编辑 原始数据 按行查看 历史
LAPTOP-R8EIHNHP\admin 提交于 2021-11-10 09:07 +08:00 . 初始化项目
/**
* @param {string} url
* @returns {Object}
*/
function param2Obj(url) {
const search = decodeURIComponent(url.split('?')[1]).replace(/\+/g, ' ')
if (!search) {
return {}
}
const obj = {}
const searchArr = search.split('&')
searchArr.forEach(v => {
const index = v.indexOf('=')
if (index !== -1) {
const name = v.substring(0, index)
const val = v.substring(index + 1, v.length)
obj[name] = val
}
})
return obj
}
module.exports = {
param2Obj
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/feiyangdefeng_yyx/vue-template-elementui.git
git@gitee.com:feiyangdefeng_yyx/vue-template-elementui.git
feiyangdefeng_yyx
vue-template-elementui
vue-template-elementui
master

搜索帮助