Uniapp获取URL中的参数

        var url = window.location.search;
        var theRequest = new Object();
        if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        var strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            theRequest[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
            }
        }
        console.log(theRequest);

 

posted @ 2022-07-23 10:14  79524795  阅读(7155)  评论(0编辑  收藏  举报