From bd82399ff1892167d8928a6bc757212d19788fdc Mon Sep 17 00:00:00 2001 From: xuwenbo <717567226@qq.com> Date: Mon, 14 Sep 2020 10:44:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=88=AA=E5=8F=96url?= =?UTF-8?q?=E6=98=AF=E5=90=A6=E5=B8=A6=E5=8F=82=E6=95=B0=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/index.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/utils/index.js b/utils/index.js index 802a37f..d8e91a3 100644 --- a/utils/index.js +++ b/utils/index.js @@ -681,13 +681,14 @@ export function handleQrCode() { export function handleUrlParam(path) { console.log(path) - - var url = path.split("?")[1]; //获取url中"?"符后的字串 - console.log(url) var theRequest = new Object(); - let strs = url.split("&"); - for (var i = 0; i < strs.length; i++) { - theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); + if(path.includes("?")){ + var url = path.split("?")[1]; //获取url中"?"符后的字串 + console.log(url) + let strs = url.split("&"); + for (var i = 0; i < strs.length; i++) { + theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]); + } } return theRequest; }