1. var http = "https://192.168.4.18?limit=20&offset=0"
    2. // [{limit:20},{offset:0}]
    3. var arr = http.split("?")[1].split("&")
    4. var res = arr.map(item=>{
    5. var obj = { }
    6. obj[item.split("=")[0]]=item.split("=")[1]
    7. return obj
    8. }
    9. console.log(res)
    1. var str = "?key=你&age=18"
    2. var res = str.slice(1)
    3. var list = res.split("&");
    4. console.log(list)
    5. var key = list[0];
    6. var age = list[1];
    7. key = key.split("=")[1];
    8. age = age.split("=")[1];
    9. var obj ={
    10. key,
    11. age
    12. }
    13. console.log(obj)

    image.png