Vue.prototype.$urlWithArgs = function(options, subIndex = 0, lastIndex =
0) { //url拼接参数 options 路由参数 subIndex 从前开始截取的下标 lastIndex截取到哪里的下标
let urlWithArgs = ""
for (let key in options) {
let value = options[key]
urlWithArgs += key + '=' + value + '&'
}
lastIndex = urlWithArgs.length - 1
urlWithArgs = urlWithArgs.substring(subIndex, lastIndex)
return urlWithArgs
}
url参数组装工具类
最新推荐文章于 2024-04-29 20:35:32 发布